-
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
Increase flexibility of collision detection options #4117
Comments
From @nickidlugash on March 18, 2016 18:49 @ansis – @peterqliu has probably touched upon more varied styling use cases, but personally I don't have any important use cases for having different values for these two properties. I'm a fan of reducing the number of arcane properties pertaining to label placement/behavior 👍 Not to open a can of worms, but this is what I actually want for collision properties (actual property names TBD):
I think the distinction between whether a symbol can overlap symbols within its own layer or with symbols in other layers is much more important for styling than the distinction between whether a symbol can overlap symbols in layers above or below the current layer. Since collision detection is per-feature, both our current properties essentially create identical behavior for symbols within the same layer (a |
Any news on this feature ? |
@nickidlugash I have a proposal in #5836 (comment) that's aimed at restoring the ability to allow overlap between symbols from multiple sources. It's backwards compatible, which means no reduction in style-spec complexity. Of:
It would support (1), but not (2). |
After discussion with @nickidlugash, I've decided to hijack this issue in favor of the "expand scope" part and give up on the proposal to make breaking changes. Even though they'd be a valuable simplification, I think the somewhat stable consensus is that we're not going to make breaking changes to the style spec anytime soon. Issue #5836 gives us motivation to add some functionality now, but we also want to make sure any changes we make are forward-compatible, so I'm going to lay out a two-phase proposal: Allow overlap with symbols in other layers (
|
If we have a way to support all the cases covered by This is definitely a nicer alternative to
|
@ChrisLoer Can you please clarify if the following is the expected behavior of *-allow-overlap in presence of multiple collision groups? 1.) *-allow-overlap enables overlapping for objects in the layer only within the collision group to which it belongs. Since no collision detection is run across collision groups, this effectively means overlap is allowed across all layers in the style. For Symbol layers, added explicitly in user code, we generally add *-allow-overlap and *-ignore-placement as true. So no changes would be required in the user code even if we modify the style to explicitly add a collision group per source. Can you please also confirm if the following is correct or not regarding *-collides-with? To enable overlapping with all layers in the style, one would need to add a *-collides-with property that contains all the collision groups including the default group. If *-allow-overlap and *-ignore-placement are deprecated would the above be the right way to accomplish what we do today with these properties? |
@mb12 The equivalent to Adding a layer in a new collision group won't affect existing layers (e.g. the ones using the default collision group). In this proposal, it is somewhat cumbersome to add a new collision group and make items in the "default" group collide with items in the new group, because you would have to explicitly add |
@nickidlugash/@lucaswoj will you have a chance to weigh in on the proposal at #4117 (comment)? Issue #5836 is a regression and it's been reported as a blocker by at least two users so far, so I want to merge #6028 or come up with an alternative solution soon. |
I would like to second @ansis' comments. This design may be more expressive & more complex than we need right now. Let's try to come up some use cases that couldn't be met by supporting 0 or 1 collision groups per layer. |
I'll try to think about this. A few more points for discussion:
I do still feel uncomfortable with this method of group assignment, as it seems unwieldy to work with. What would a UI in Studio look like for this? I think we would need to implement something like Studio-only variables to manage the collision groups. /cc @samanpwbb We currently have separate collision properties for text and icon – do we need to? Are there use cases for assigning different values for text and icon in the same style layer? I can't find/recall any previous discussions around this topic. If there are not use cases, if we move forward with this proposal, could we make just 2 new properties that apply to both?: |
That seems fine to me -- I don't know how it's useful to manage those separately, either. And at least in terms of fixing the regression from introducing cross-source placement, we don't need that granularity.
Yeah really interested to hear ideas here. As far as I know we don't so far have any pressing need for the
Maybe something like the "Labels" GitHub UI? |
Perhaps we could forgo the concept of "groups" entirely and simply have each layer list the other layers it collides with, with some keyword for "all symbol layers" available. "collides": ["all"]
"collides": ["self"]
"collides": ["layer-id-1", "layer-id-2", "layer-id-3"]
"collides": ["self", "layer-id-1", "layer-id-2", "layer-id-3"] There may be cases where this creates extra bookkeeping or reduces extensibility; however those problems exist with a "groups" approach too. |
I think the problem with that approach is if you're using a core style and then adding a couple layers in another source, and you want to keep collision detection for the layers in that other source independent, you have to go through and modify the |
At least in my use case, it would be important that I don't have to know anything about the base map which is static and never changes. If I added dynamic elements on top of the base map, I would like to just define that the dynamic elements cannot interfere with the base map without knowing any layer names or such that are provided by the base map. This is extremely easy in #6028 by just adding a collision group for those layers which contain dynamic elements and are added by me on top of the base map. |
@lucaswoj and I talked about this a bit yesterday. One thing I didn't understand from his proposal in #4117 (comment) is that it probably would include a "default group" for every layer that didn't specify a
We're not super satisfied with either approach and are waiting for inspiration to strike on a third option. Maybe "style components" could somehow give us the grouping we're looking for? @mourner suggested trying to hide almost all of the |
I'm open to any kind of technical approach. This is clearly something which appears only when you have dynamic data on top of the map so it shouldn't decrease the performance in the normal use cases. I think one of the problems is that this must work without having any access to (or knowledge of) the background map and its style. So when adding dynamic elements by using One approach without thinking the implementation would be that the user "freezes" the background map by adding a specific layer above the background map and then add above that the new feature layers which know nothing about the features in the layers below. In this way, you don't have to specify any collision groups, names etc. Of course, it doesn't give as much flexibility as other options. |
As a Studio team representative, I strongly urge us to keep simplicity and consistency in mind with new spec proposals. Here are a few thoughts: To bring this back to the original topic of the issue, I think there's a big opportunity to simplify collision detection configuration in the spec. I'd love to see us combine icon and text collision, and move away from both What about a single We wouldn't need to deprecate I see there is a separate need for more nuanced collision detection, where user manages separate groups of layers, each group collides only within itself. I have two thoughts here. Short term, check out https://github.com/mapbox/mapbox-gl-sync-move. It's a great tool that lets you sync map state between two GL maps. Long term, components seem like a great abstraction for supporting this behavior. Rather than expecting each layer to manage it's collision, or using a separate root property for managing collision, we could add component-level collision properties that allow user to define if a component should respect symbol layers in other components or not. Lastly, the Studio team does not have the capacity to build dedicated UIs for fine-grained collision detection, but we will be investing significant design + engineering efforts into supporting a component pattern. |
I think the I would assume that the property would be |
This is somehow very nice example: https://www.mapbox.com/mapbox-gl-js/example/animate-point-along-route/ What would be the simplest way to prevent the state names disappearing when the airplane is above them? The current behavior is distracting in this kind of cases when you expect the background to be static and frozen. |
@ttsirkia That example is fixed now. |
Did you change the example or was this problem already resolved earlier when the collision detection mechanism was changed? |
I was wondering if an implementation similar to what was suggested here is still in consideration. I am working on some features at the moment where I would love to be able to take full control over collisions on a presentation level since I need to combine quite a lot of dynamic data sources, and I do not really want to structure/combine those data sources so that it satisfies the visual design of the map. |
In the past three years has there been any progress, or workarounds discovered, on the initial goal #1 of how to enable overlap with other layers but not within the same layer? |
From @ansis on March 18, 2016 0:53
There are currently two properties that affect how a symbol
-allow-overlap
determines if previous symbols affect the placement of the current symbol-ignore-placement
determines if the current symbol will affect the placement of layer symbolsIn most cases you want both to have the same value. I can't think of an example you would want them to be different.
We should remove -ignore-placement and make -allow-overlap do what both these properties currently do.
@nickidlugash @peterqliu can you imagine a case where you would want these two properties to be separate?
Copied from original issue: mapbox/mapbox-gl-style-spec#429
The text was updated successfully, but these errors were encountered: