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.

Runtime Styling API - Filters on number properties not applied properly #5978

Closed

Description

@ivovandongen

When setting a filter like:

layer.setFilter(eq("stroke-width", 3.0));

The filter never evaluates to true.

Activity

  1. added
    Android
    on Aug 12, 2016
  2. added this to the android-v4.2.0 milestone on Aug 12, 2016
  3. self-assigned this
    on Aug 12, 2016
  4. ouska commented on Feb 26, 2017

    @ouska

    Hello,
    filtering by numbers still does not work for me. Trying on version 4.2.2 and also 5.0.0-beta.1 and I am experiencing the same odd behavior.

    When I have source
    {"size_text":"193 KB","idzxy":902770176}
    and filter
    symbolLayer.setFilter(eq("idzxy", 902770176));
    then filter evaluates to true and I can see the symbol.

    But another symbol
    {"size_text":"194 KB","idzxy":902760176}
    and filter
    symbolLayer.setFilter(eq("idzxy", 902760176));
    then filter evaluates to false and I cannot see the symbol.

    Has anybody chance to confirm this behavior and propose the solution?
    Thanks.

  5. ivovandongen commented on Feb 28, 2017

    @ivovandongen
    ContributorAuthor

    @ouska Thanks for the report. Would you have the opportunity to make a small sample project which demonstrates the behaviour you describe here? I can't seem to reproduce this with the information in the ticket.

  6. ouska commented on Mar 2, 2017

    @ouska

    @ivovandongen
    Hello,
    project is not needed. Just throw these lines into your general mapbox project. Today I tested it with the version 5.0.0-SNAPSHOT. The same result. Let me know whether it helps or not.

    public void onMapReady(MapboxMap map) {
    StringBuilder b = new StringBuilder();
    b.append("{"type": "FeatureCollection", "features": [");
    b.append("{"type": "Feature", "properties": {"id": 100}, ");
    b.append(""geometry": {"type": "Point", "coordinates": [ 1.716198, 51.226369 ]}},");
    b.append("{"type": "Feature", "properties": {"id": 200}, ");
    b.append(""geometry": {"type": "Point", "coordinates": [ 1.516198, 51.026369 ]}}");
    b.append("]}");
    map.addSource(new GeoJsonSource("vt_centroid", b.toString()));
    SymbolLayer slayer = new SymbolLayer("layer", "vt_centroid");
    slayer.setProperties(textField("X"));
    slayer.setFilter(in("id", 100, 200));
    map.addLayer(slayer);
    }

    you will see two "X" letters between Dover (GB) and Calais (FR) - you must zoom enough to see both Xes.

    Now change ID values to 902770175, 902770176 instead of 100 and 200. You will see only one X with ID 902770176. There must be something odd with these high numbers - even they are regular Integers. I suspect some number cast in native part of the library.

    public void onMapReady(MapboxMap map) {
    StringBuilder b = new StringBuilder();
    b.append("{"type": "FeatureCollection", "features": [");
    b.append("{"type": "Feature", "properties": {"id": 902770175}, ");
    b.append(""geometry": {"type": "Point", "coordinates": [ 1.716198, 51.226369 ]}},");
    b.append("{"type": "Feature", "properties": {"id": 902770176}, ");
    b.append(""geometry": {"type": "Point", "coordinates": [ 1.516198, 51.026369 ]}}");
    b.append("]}");
    map.addSource(new GeoJsonSource("vt_centroid", b.toString()));
    SymbolLayer slayer = new SymbolLayer("layer", "vt_centroid");
    slayer.setProperties(textField("X"));
    slayer.setFilter(in("id", 902770175, 902770176));
    map.addLayer(slayer);
    }

    O.

  7. ouska commented on Mar 21, 2017

    @ouska

    Hi @ivovandongen, have you had a chance to look at this? Any progress? Is there something more I can do about it?
    Thank you for the feedback.
    VO.

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

Metadata

Metadata

Assignees

Labels

Androidbug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions