Skip to content
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

Support float values in priority for label collision #692

Open
nvkelso opened this issue Jan 10, 2019 · 2 comments
Open

Support float values in priority for label collision #692

nvkelso opened this issue Jan 10, 2019 · 2 comments

Comments

@nvkelso
Copy link
Member

nvkelso commented Jan 10, 2019

Following up from tilezen/vector-datasource#988, it sounds like Tangram JS does support float values on the priority property (but Tangram ES does not currently). Let's verify that and if so update the documentation. Else add support and document.

This comment is the tl;dr:

Specifically, this should allow a function like (which returns a float):

priority = feature.properties.min_zoom + (1 - 1 / feature.properties.collision_rank) * 0.1

Alternatively we've also talked about multi-key priority which could give more performance than a JS function. For example:

priority: [min_zoom, collision_rank]

Though in some other cases (like name) we treat lists as fallbacks not tie breakers.

@nvkelso
Copy link
Member Author

nvkelso commented Jan 10, 2019

@bcamper I nominate this for v0.17 milestone :)

@bcamper
Copy link
Member

bcamper commented Jan 11, 2019

Confirmed fractional priorities work in Tangram JS already. So no code change :) Documentation should be updated, I'll leave this open for that -- but perhaps wait until it is supported in ES too, so we don't have to update twice?

So what we will want in the scene file is:

priority: function(){ return feature.min_zoom + (1 - 1 / feature.collision_rank) * 0.1; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants