Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
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

Closed

Description

@hallahan

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?

Activity

  1. incanus commented on Jul 2, 2014

    @incanus
    Contributor

    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 :-)

  2. incanus commented on Jul 2, 2014

    @incanus
    Contributor

    This will get a Cocoa API, by the way. So you should be able to turn gestures at a CGPoint into 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#L115

  3. hallahan commented on Jul 2, 2014

    @hallahan
    ContributorAuthor

    Alright, I'll stand by. Thanks!

  4. hallahan commented on Apr 9, 2015

    @hallahan
    ContributorAuthor

    What is the status for a native featuresAt implementation? Is the ability to select a feature on the map going to be a feasible use case for native?

  5. incanus commented on Apr 9, 2015

    @incanus
    Contributor

    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.

  6. taylortrimble commented on Apr 9, 2015

    @taylortrimble

    I am so pumped for featuresAt. Thanks all!

  7. hallahan commented on Apr 9, 2015

    @hallahan
    ContributorAuthor

    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?

  8. incanus commented on Apr 9, 2015

    @incanus
    Contributor

    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.

  9. hallahan commented on Apr 9, 2015

    @hallahan
    ContributorAuthor

    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?

  10. hallahan commented on Apr 9, 2015

    @hallahan
    ContributorAuthor

    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.

  11. added a commit that references this issue on Nov 25, 2015
  12. self-assigned this
    on Nov 25, 2015
  13. 94 remaining items

  14. added 10 commits that reference this issue on Jul 27, 2016
  15. tobrun commented on Aug 4, 2016

    @tobrun
    Member

    @ivovandongen created an android follow up issue in #5869.
    Closing as all other items were ticketed out or resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GL JS parityfeature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions