-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diagram to illustrate difference between queryRenderedFeatures
and querySourceFeatures
#3751
Comments
🙌 Thank you @kronick! I'm excited about this. If the docs are destined for https://www.mapbox.com/mapbox-gl-js/api you can drop any raster images in |
Okay, thanks for taking a whack at this @kronick . In terms of getting this live, a few things:
|
Looks like a great start @kronick. Another important distinction between Take, for example, a GeoJSON point at [0, 0]. This source feature has an infinitesimal size and is positioned at [0, 0]. A corresponding rendered symbol feature with an offset of [100, 100] and an icon size of 50 will have a size of 50px by 50px and centered around [100, 100]. The differences between query options are hopefully going to go away in the near future 😄. |
This is the confusion (i.e. #3147) I'm trying to clear up and I believe what I'm diagramming is the real, though somewhat counterintuitive, behavior: points will be duplicated in the result set if they occur in more than one VT, accounting for label size in @lucaswoj That's a good distinction too and if I understand correctly, it's what makes querying with a point geometry work— In the end, I don't think we'll capture all the subtleties and features of these functions in a couple of diagrams, but these are the big questions I hope to clear up with a visual aid:
|
How do we get all data from the vector tiles ? (This is in reference to previous answer: "If you want all data, use another method" --> what is the other method? |
@arethasamuel The answer to that question depends highly on your use case. If you're doing serious data processing, you might want to use something like https://wiki.openstreetmap.org/wiki/Overpass_API to access OSM data directly. Our vector tiles are optimized for rendering rather than data processing. |
I am having some issues with this as well, and it seems like there may be a way to accomplish what I want simply, but it is hard to find the correct way with the docs and API. I am building an overlap UI, where we use the clicked point (from the click event) to get the list of overlapping features on the map, and then clipping the geometry of all the features together in order to show the area that overlaps. This works fine if you are zoomed out to the full bounds of all geometries, but if you zoom in close to where the geometry fills the current view area, only the vector tile's geometry is given in both the event and This results in, when you zoom out, the clipped geometry being the size of the viewport when it should actually include the whole geometry of that feature, even if it is bigger in area than the viewport. It is a bit frustrating not having a direct way to access the full geometry of the features that are clicked. I am not sure that this need constitutes "serious data processing", as all I need is the full geometry to be returned from these functions. Right now, I am having to take a round trip back to the original source of each layer and filter for that specific feature. Edit: This explanation is a bit confusing, so here is a jsFiddle: http://jsfiddle.net/t6s4yrdz/11/ All you need to do is click, then zoom out. |
Proposing to add a diagram to the docs to more clearly illustrate the different between what
queryRenderedFeatures()
andquerySourceFeatures()
do, to clear up confusion as in #3744. I can follow the visual style set in https://www.mapbox.com/vector-tiles/specification/. Open to opinions on how to integrate raster images if I go that route, or I can build these as inline SVGs.cc/ @lyzidiamond @tmcw @danswick
The text was updated successfully, but these errors were encountered: