mapbox-maps-flutter
mapbox-maps-flutter copied to clipboard
queryRenderedFeatures results in empty list when using layerIds in RenderedQueryOptions.
Here is my code, which is inside my _onMapTapped() function :
List<QueriedRenderedFeature?> queriedRenderedFeatures = await mapboxMap!.queryRenderedFeatures(
RenderedQueryGeometry(value: jsonEncode(screenCoordinate.encode()), type: Type.SCREEN_COORDINATE),
RenderedQueryOptions(filter: null),
);
if (queriedRenderedFeatures.isNotEmpty) {
queriedRenderedFeatures.forEach((element) {
print(element?.layers.toString());
print(element?.queriedFeature.feature["id"]);
});
} else {
print("no result");
}
And it produces the expected output ;
But as soon as I change
RenderedQueryOptions(filter: null)
to
RenderedQueryOptions(layerIds: ["landuse"], filter: null),
and click on the same spot I get empty results :
Probably due to #190
@manulgdc Thank you for making the report! Is this behavior consistent across platforms(iOS/Android)? Do you use one of the default styles?
I couldn't reproduce this behavior - for me the results are still there when I specify a layerId, I tested it with the MapStyle.Light.