You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Feature eventing (native equivalent of queryRenderedFeatures and querySourceFeatures) #352
I've been playing with MapboxGL, and I'm trying to figure out how to handle click events to select features. Is this functionality built in?
Looking at the JavaScript in the several blog posts that use mapbox-gl-js, I am able to got the Point object from a click event. Then, I see a function map.featuresAt, but I am not able to get it to return any features...
Any clues? Regarding the native libraries, would this be in the Cocoa library?
It's not there yet on the native side, but it's coming. I could have sworn we had a ticket for this over here, but I guess not as I couldn't find it. So this is it :-)
It will be eventually, but the focus for now has just been on point annotations, which exist in a runtime style layer and query based on ~50px square padding for touch gestures. We'll eventually port over featuresAt and allow querying of all of the style layers such as OSM base data.
Being able to select OSM base data would be an extremely valuable feature. This is something I'd enjoy working on. Could you point me in the right direction?
Yes, I would check out the featuresAt functionality in gl-js. The basic idea is an R-tree that bins the features at parse time so that efficient spatial queries can be made at runtime in response to the "at" and a radius. The structures that exist now aren't indexing parsed features this way.
Point annotations do index based on tiles made at runtime as annotations are added and removed, which is how gestural touch of points on the map that are rendered in GL was possible.
It looks like you have boost's rtree in there. Are you using this in the same way as rbush in the JS implementation? Are you saying only points are added to a spatial index?
Would we want to use the same container as is being used here for map geometries? I know PostGIS uses geos. I've used JTS Topology Suite in Java, the lib geos was ported from.
Activity
incanus commentedon Jul 2, 2014
It's not there yet on the native side, but it's coming. I could have sworn we had a ticket for this over here, but I guess not as I couldn't find it. So this is it :-)
incanus commentedon Jul 2, 2014
This will get a Cocoa API, by the way. So you should be able to turn gestures at a
CGPointinto an array or dictionary of vector features, which you could then turn around into both data introspection or style modification (feature highlighting, etc.). Something like how UTFGrid works over here: https://github.com/mapbox/mapbox-ios-sdk/blob/f47ae3d96a27661eb4f888660787bffdf0294492/MapView/Map/RMInteractiveSource.h#L115hallahan commentedon Jul 2, 2014
Alright, I'll stand by. Thanks!
hallahan commentedon Apr 9, 2015
What is the status for a native
featuresAtimplementation? Is the ability to select a feature on the map going to be a feasible use case for native?incanus commentedon Apr 9, 2015
It will be eventually, but the focus for now has just been on point annotations, which exist in a runtime style layer and query based on
~50pxsquare padding for touch gestures. We'll eventually port overfeaturesAtand allow querying of all of the style layers such as OSM base data.taylortrimble commentedon Apr 9, 2015
I am so pumped for
featuresAt. Thanks all!hallahan commentedon Apr 9, 2015
Being able to select OSM base data would be an extremely valuable feature. This is something I'd enjoy working on. Could you point me in the right direction?
incanus commentedon Apr 9, 2015
Yes, I would check out the
featuresAtfunctionality ingl-js. The basic idea is an R-tree that bins the features at parse time so that efficient spatial queries can be made at runtime in response to the "at" and a radius. The structures that exist now aren't indexing parsed features this way.Point annotations do index based on tiles made at runtime as annotations are added and removed, which is how gestural touch of points on the map that are rendered in GL was possible.
hallahan commentedon Apr 9, 2015
It looks like you have boost's rtree in there. Are you using this in the same way as rbush in the JS implementation? Are you saying only points are added to a spatial index?
hallahan commentedon Apr 9, 2015
I'm poking around, and the only actual rtree usage I am seeing is in
collision.hpp. It looks like it's being used to make sure labels don't collide?https://github.com/mapbox/mapbox-gl-native/blob/master/src/mbgl/text/collision.hpp#L32
Would we want to use the same container as is being used here for map geometries? I know PostGIS uses
geos. I've used JTS Topology Suite in Java, the lib geos was ported from.http://stackoverflow.com/questions/9891374/is-boost-geometry-mature-enough
What do you guys think? Clearly this is not a trivial feature.
refs #352: catalog (hardcoded: POI) features on tile parse
94 remaining items
[android] #352 - introducing FeatureWrapper, added PolygonFeature, de…
[android] #352 - added feature wrapper
[android] #352 - added PolylineFeature
[android] #352 - Added feature objects for multi variants, added supp…
[android] #352 - bring over concepts from runtime styling (value.cpp …
[android] #352 - update gyp with new C++ files, added feature concept…
[android] #352 - android-conversion from runtime styling
[android] #352 - correct namespaces, renaming conversion to feature e…
[android] #352 - attempt to create a visitor pattern
[android] #352 - rework annotations inheritance, added feature concept
tobrun commentedon Aug 4, 2016
@ivovandongen created an android follow up issue in #5869.
Closing as all other items were ticketed out or resolved.