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.
In #6217 (comment) we discussed some possibilities to make the documentation for VT and cluster options clearer for native mobile developers. This issue is to continue that discussion and implement improved documentation since #6217 itself is functional and has good enough documentation.
Thinking ahead to when we document these options: buffer and clusterRadius will unfortunately be difficult APIs for developers to reason about. They’re expressed in units of “⅟₅₁₂ of a tile”, which don’t correspond to any fixed real-world or screen distances, yet we don’t offer any way for the developer to find out the size of the tile at a given zoom level.
Fortunately, I don’t think this needs to be one of those “guess-and-check” APIs that we try to avoid exposing in the SDK. Rather than the formulation used in the style specification documentation, I think we should talk about the buffer and cluster radius being expressed in screen points (which is true at integral zoom levels), with a caveat that they may be scaled up to 2× between integral zoom levels. (The offset threshold implemented in #1843 is only for raster and video sources, so it won’t affect clustering.)
The style specification talks about “⅟₅₁₂ of a tile” units. I assume that means a tile is 512 of these units tall and 512 of these units wide, not that there are 512 to a tile, correct? If so, that should be an easy documentation fix.
On Retina displays, do these ⅟₅₁₂-of-a-tile units remain ⅟₅₁₂-of-a-tile units, or do they become ⅟₁₀₂₄-of-a-tile units?
The style specification describes tolerance as a “Douglas-Peucker simplification tolerance”, but in this case that means it’s also measured in ⅟₅₁₂-of-a-tile units, right? Most descriptions of the Douglas–Peucker algorithm discuss curve simplification specifically, so it’ll be unclear to the developer how the tolerance relates to clustering. We can probably clarify the documentation a bit by talking about a minimum distance between points.
We’re tagging this as a beta blocker because the API documentation is potentially misleading until we resolve these three issues.
The style specification talks about “⅟₅₁₂ of a tile” units. I assume that means a tile is 512 of these units tall and 512 of these units wide, not that there are 512 to a tile, correct? If so, that should be an easy documentation fix.
Initially I described the units as "relative to a 512px tile", because a tile loaded on a round zoom will be displayed as 512px. Could we just say "in pixels"? I agree that the current definition is a bit confusing. cc @lucaswoj who did copy edits on this.
On Retina displays, do these ⅟₅₁₂-of-a-tile units remain ⅟₅₁₂-of-a-tile units, or do they become ⅟₁₀₂₄-of-a-tile units?
Nope, still relative to a tile as if it was 512px.
The style specification describes tolerance as a “Douglas-Peucker simplification tolerance”, but in this case that means it’s also measured in ⅟₅₁₂-of-a-tile units, right? Most descriptions of the Douglas–Peucker algorithm discuss curve simplification specifically, so it’ll be unclear to the developer how the tolerance relates to clustering. We can probably clarify the documentation a bit by talking about a minimum distance between points.
tolerance does not affect clustering at all, it's purely for lines/polygons.
Unfortunately, we can’t on Apple platforms, because “pixel” has a specific meaning that varies by resolution. A Mac, for example, can simultaneously have a LoDPI screen on which one pixel is one point and a HiDPI (Retina) screen on which one pixel is half a point.
So a 512×512 tile actually has 512 of these units on each side, correct? If that’s the case, “⅟₅₁₂ of a tile” is misleading.
tolerance does not affect clustering at all, it's purely for lines/polygons.
I was mistaken in thinking all the options were related to clustering. Thanks for the clarification!
In regards to the discussion about screen points, I'm not sure where or how to mention that concept even in the platform specific documentation. In practice, the value controls the density of cluster markers in a tile. However, I can't think of a great way to loop in the concept of points with the current interface without making the documentation less clear than it is already. For example, when I look at the same data set with cluster radius values of 512, 256, and 128 I see these results:
My guess is that most developers won't care about fine grained control and may find an abstraction helpful (i.e. MGLClusterDensityLow, MGLClusterDensityHigh) -- something like kCLLocationAccuracyThreeKilometers -> kCLLocationAccuracyBestForNavigation that represents a double (and the developer is free to set a double if they need fine grained control) or just use the constant if they are less concerned.
Do you have any ideas for how to proceed so we can close this blocker?
Hey! Newb here, just switching to mapbox SDK (ios/android) and was just looking for clustering support. Reading through all the open issues trying to get up to speed on where you guys are at.
Honestly some of the pixel stuff you are talking about is over my head but here are my 2 cents.
In other map SDK's I'm used to seeing a maxClusterRadius or similar property. Most likely the double you are referring to. Essentially how close points need to be (zoom dependent) to cluster together. As a developer I will test 1,000 or 10,000 markers and like the flexibility to just change a value to see how it changes on the map and to find the value that fits my needs. Perhaps you can have a default for other people that won't really care.
Here's the example from Leaflet Marker Cluster plugin: maxClusterRadius: The maximum radius that a cluster will cover from the central marker (in pixels). Default 80. Decreasing will make more, smaller clusters.
So, whatever the field is, we the users just need some value to manipulate until we get the visual granularity we are looking for.
In other map SDK's I'm used to seeing a maxClusterRadius or similar property. Most likely the double you are referring to. Essentially how close points need to be (zoom dependent) to cluster together.
Hi @nitrag, thanks for your 2¢. One of the options in question, MGLGeoJSONClusterRadiusOption, is indeed an analogue to the maxClusterRadius field you’re asking about. So yes, there is an option developers like you can hand-tune to get the results you’re looking for.
However, I can't think of a great way to loop in the concept of points with the current interface without making the documentation less clear than it is already.
No platform-specific discussion about points is needed, because the final language in mapbox/mapbox-gl-style-spec#492 and #6411 ended up not mentioning pixels at all, and apparently these values have the same visual effect regardless of the screen’s pixel density.
My guess is that most developers won't care about fine grained control and may find an abstraction helpful (i.e. MGLClusterDensityLow, MGLClusterDensityHigh) -- something like kCLLocationAccuracyThreeKilometers -> kCLLocationAccuracyBestForNavigation that represents a double (and the developer is free to set a double if they need fine grained control) or just use the constant if they are less concerned.
Another example is MGLMapView.decelerationRate, for which we have the three constants MGLMapViewDecelerationRateNormal, MGLMapViewDecelerationRateFast, and MGLMapViewDecelerationRateImmediate but allow other values as well. I don’t have a good sense of the values developers would typically want for this option (other than the default of 50); do you?
So, whatever the field is, we the users just need some value to manipulate until we get the visual granularity we are looking for.
It’s true that you can often hand-tune an option until the result looks good. But we should also try to enable dynamic use cases where the right value can’t be determined until runtime. Physical units (like MGLCamera.altitude), screen units (MKRoadWidthAtZoomScale()), and “milepost” constants (MGLMapViewDecelerationRate…) help to ground the API in reality and make the results more predictable. That can be important when attempting to synchronize the map with other UI elements, UIDynamics, etc.
But enough philosophy. 😄 Let’s go with what we have in #6411. The nice thing about an option dictionary is that we can easily add a different option in the future if we come up with a better idea.
Activity
boundsj commentedon Sep 1, 2016
Ref mapbox/mapbox-gl-js#2985
1ec5 commentedon Sep 1, 2016
Duplicate of #5960?
boundsj commentedon Sep 1, 2016
I'm happy with #5960, just wanted to capture the specifics you brought up about MGLGeoJSONSource and absolve #5962. Closing!
boundsj commentedon Sep 2, 2016
Actually going to keep this open and block the beta with it so we can have the discussion about how to make these options mean something.
1ec5 commentedon Sep 2, 2016
To recap:
We’re tagging this as a beta blocker because the API documentation is potentially misleading until we resolve these three issues.
[-]Add better documentation for MGLGeoJSONSource options[/-][+]Clarify MGLGeoJSONSource option units[/+]mourner commentedon Sep 13, 2016
Initially I described the units as "relative to a 512px tile", because a tile loaded on a round zoom will be displayed as 512px. Could we just say "in pixels"? I agree that the current definition is a bit confusing. cc @lucaswoj who did copy edits on this.
Nope, still relative to a tile as if it was 512px.
tolerancedoes not affect clustering at all, it's purely for lines/polygons.1ec5 commentedon Sep 13, 2016
Unfortunately, we can’t on Apple platforms, because “pixel” has a specific meaning that varies by resolution. A Mac, for example, can simultaneously have a LoDPI screen on which one pixel is one point and a HiDPI (Retina) screen on which one pixel is half a point.
So a 512×512 tile actually has 512 of these units on each side, correct? If that’s the case, “⅟₅₁₂ of a tile” is misleading.
I was mistaken in thinking all the options were related to clustering. Thanks for the clarification!
lucaswoj commentedon Sep 13, 2016
I pushed a PR mapbox/mapbox-gl-style-spec#492 which clarifies the meaning of the docs. It does not address the transition to defining screen points.
1ec5 commentedon Sep 13, 2016
That’s fine; that’s a platform-specific concept anyways.
boundsj commentedon Sep 21, 2016
@1ec5 in #6411 I propose an update to the ios/macos API documentation to reflect the changes @lucaswoj made in mapbox/mapbox-gl-style-spec#492.
In regards to the discussion about screen points, I'm not sure where or how to mention that concept even in the platform specific documentation. In practice, the value controls the density of cluster markers in a tile. However, I can't think of a great way to loop in the concept of points with the current interface without making the documentation less clear than it is already. For example, when I look at the same data set with cluster radius values of 512, 256, and 128 I see these results:
My guess is that most developers won't care about fine grained control and may find an abstraction helpful (i.e.
MGLClusterDensityLow,MGLClusterDensityHigh) -- something likekCLLocationAccuracyThreeKilometers->kCLLocationAccuracyBestForNavigationthat represents a double (and the developer is free to set a double if they need fine grained control) or just use the constant if they are less concerned.Do you have any ideas for how to proceed so we can close this blocker?
nitrag commentedon Sep 21, 2016
Hey! Newb here, just switching to mapbox SDK (ios/android) and was just looking for clustering support. Reading through all the open issues trying to get up to speed on where you guys are at.
Honestly some of the pixel stuff you are talking about is over my head but here are my 2 cents.
In other map SDK's I'm used to seeing a
maxClusterRadiusor similar property. Most likely the double you are referring to. Essentially how close points need to be (zoom dependent) to cluster together. As a developer I will test 1,000 or 10,000 markers and like the flexibility to just change a value to see how it changes on the map and to find the value that fits my needs. Perhaps you can have a default for other people that won't really care.Here's the example from Leaflet Marker Cluster plugin:
maxClusterRadius: The maximum radius that a cluster will cover from the central marker (in pixels). Default 80. Decreasing will make more, smaller clusters.So, whatever the field is, we the users just need some value to manipulate until we get the visual granularity we are looking for.
Thanks! Eagerly awaiting this feature!
1ec5 commentedon Sep 21, 2016
Hi @nitrag, thanks for your 2¢. One of the options in question,
MGLGeoJSONClusterRadiusOption, is indeed an analogue to themaxClusterRadiusfield you’re asking about. So yes, there is an option developers like you can hand-tune to get the results you’re looking for.No platform-specific discussion about points is needed, because the final language in mapbox/mapbox-gl-style-spec#492 and #6411 ended up not mentioning pixels at all, and apparently these values have the same visual effect regardless of the screen’s pixel density.
Another example is
MGLMapView.decelerationRate, for which we have the three constantsMGLMapViewDecelerationRateNormal,MGLMapViewDecelerationRateFast, andMGLMapViewDecelerationRateImmediatebut allow other values as well. I don’t have a good sense of the values developers would typically want for this option (other than the default of 50); do you?It’s true that you can often hand-tune an option until the result looks good. But we should also try to enable dynamic use cases where the right value can’t be determined until runtime. Physical units (like
MGLCamera.altitude), screen units (MKRoadWidthAtZoomScale()), and “milepost” constants (MGLMapViewDecelerationRate…) help to ground the API in reality and make the results more predictable. That can be important when attempting to synchronize the map with other UI elements, UIDynamics, etc.But enough philosophy. 😄 Let’s go with what we have in #6411. The nice thing about an option dictionary is that we can easily add a different option in the future if we come up with a better idea.