Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Android runtime style API bug with filters & numbers #6040

Closed

Description

@incanus

Per extended chat with @ivovandongen—writing this up so we have a concrete place for it on which to hang commits and eventually mark it resolved.

Here is a sample data file:

https://gist.github.com/incanus/0607dccb035cd9b55ff95faa1b60cf8c

I've added this to a basic Mapbox Studio style at mapbox://styles/justin/cirnit09r000bg1mb4kxqmvwi.

Each segment of the data file is addressable by a uniqid numeric field, e.g. 10191020. Something like this should be possible:

LineLayer segments = mapboxMap.getLayerAs("segments");
        segments.setFilter(eq("uniqid", 10191020));
        segments.setProperties(lineColor(Color.GREEN),
                lineWidth(10f),
                lineOpacity(0.5f));

This is the analog to doing it via the GUI in Studio:

screen shot 2016-08-11 at 5 29 53 pm

However, all segments will get their style changed, not just the single one of the ~20 with that uniqid. The filter seems to be ignored.

Numeric comparison, either types or precision, seems to be at fault. @ivovandongen tried a fix at ddf0d25 but it still doesn't seem to do it.

I will also test c34130a and see why it might be working but my example isn't. Is it maybe the size of the number in my data field?

/cc @frederoni just for when we might hit this on iOS filters.

Activity

  1. added
    Android
    on Aug 16, 2016
  2. added this to the android-v4.2.0 milestone on Aug 16, 2016
  3. incanus commented on Aug 16, 2016

    @incanus
    ContributorAuthor

    Confirmed that I am seeing the parks example in c34130a work just fine in my setup, so it's something more unique about my data set.

  4. ivovandongen commented on Aug 17, 2016

    @ivovandongen
    Contributor

    @incanus I've tried out your json and code snippets by working it into the test app and it just seems to work. Can't say what's going wrong with your example based on the information you provided. See the patch here for more information: https://gist.github.com/ivovandongen/f6ac2d5edd66844f853126759134bc82

    segments

    Hope that helps you.

  5. removed their assignment
    on Aug 17, 2016
  6. incanus commented on Aug 17, 2016

    @incanus
    ContributorAuthor

    @ivovandongen You are adding a new layer rather than changing an existing one in Studio. See my original code in #6040 (comment):

    LineLayer segments = mapboxMap.getLayerAs("segments");
            segments.setFilter(eq("uniqid", 10191020));
            segments.setProperties(lineColor(Color.GREEN),
                    lineWidth(10f),
                    lineOpacity(0.5f));

    This is finding the style layer which was created in Studio server-side from the source GeoJSON, not in the app. It uses getLayerAs() rather than your example of new LineLayer(). We should be able to query this existing layer, then change its properties.

    Try this patch exactly to reproduce the problem:

    https://gist.github.com/incanus/b89e1b07bdbcc921b4ae928901584e93

    What should happen is a styling similar to what's seen in Studio above, but what actually happens is that the whole of the segments layer is styled green.

  7. incanus commented on Aug 18, 2016

    @incanus
    ContributorAuthor

    This may actually be rendering related, not filter. See #5701.

  8. incanus commented on Aug 18, 2016

    @incanus
    ContributorAuthor

    That's exactly what we're seeing here.

    anigif-1471550047

    I've confirmed that things work with both the primitive as the value as well as an Integer. Closing here and picking up in #5701. Thanks for your work @ivovandongen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Androidbugruntime styling

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions