Skip to content
This repository has been 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
ivovandongen opened this issue Aug 12, 2016 · 4 comments
Closed
Assignees
Labels
Android Mapbox Maps SDK for Android bug

Comments

@ivovandongen
Copy link
Contributor

When setting a filter like:

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

The filter never evaluates to true.

@ouska
Copy link

ouska commented Feb 26, 2017

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.

@ivovandongen
Copy link
Contributor Author

@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.

@ouska
Copy link

ouska commented Mar 2, 2017

@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.

@ouska
Copy link

ouska commented Mar 21, 2017

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android bug
Projects
None yet
Development

No branches or pull requests

2 participants