Is there a way to get the fillLayer added in mapboxMap from a GPS Position?
I have a map with many fillLayer from geoJsonSource, each of them has a value property. I want to know in which fillLayer the device is geographically so I can tell the user what is the value of the current place.
Each color represent the value I want to get from GPS position
You can use QueryRenderedFeature()
to query a position and from that layer and then get the geojson property. An example doing this would be:
final PointF pixel = mapboxMap.getProjection().toScreenLocation(point);
List<Feature> features = mapboxMap.queryRenderedFeatures(pixel, "my-layer");
Now you should be able to grab the properties from the Feature
object.