mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.37k stars 1.33k forks source link

Features returned by queryRenderedFeatures should return layer #7162

Open 1ec5 opened 7 years ago

1ec5 commented 7 years ago

If you call queryRenderedFeatures() – or on iOS and macOS, -[MGLMapView visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:] – the features you get back should indicate the layer(s) the feature comes from. It should at least be a layer identifier. Better yet, we could port mapbox/mapbox-gl-js#879 and include the evaluated layer as part of the feature object.

One use case is that, once #6097 lands, I’d like to implement in macosapp where you can right-click at a point and select Reveal in Layers from the context menu to select the layer that contains that feature in the Layers sidebar.

A more real-world use case might be that the developer wants to get all the roads that intersect at a given location, arranged in order, but the roads are spread among multiple layers (as they are in Mapbox Streets). If the developer issues multiple calls to queryRenderedFeatures(), one per layer, they’ll get all the roads, but they won’t be able to tell which road is on top of which without looking at the list of layers.

/cc @jfirebaugh @lbud @ericrwolfe

stale[bot] commented 5 years ago

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

1ec5 commented 5 years ago

Still needed for parity with GL JS. This feature would be very useful for working with expressions if mapbox/mapbox-gl-js#5677 were addressed at the same time.

/cc @cmtoomey

stale[bot] commented 4 years ago

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.