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

icon-offset and icon-translate has icons rendered behind other layers #1882

Closed
averas opened this issue Jan 3, 2016 · 11 comments
Closed

icon-offset and icon-translate has icons rendered behind other layers #1882

averas opened this issue Jan 3, 2016 · 11 comments

Comments

@averas
Copy link
Contributor

averas commented Jan 3, 2016

I'm trying to realise a point layer with multiple symbol icons per point. To achieve this I've tried using the layout/paint properties icon-offset and icon-translate and while both do the trick, they both suffer from the fact that the adjusted icons are overpainted by other layers occasionally (tile edges?). Is this a bug or is it not meant to be used like this?

icon-offset

@peterqliu
Copy link
Contributor

#757

@averas averas changed the title icon-offset and icon-translate has icons rendered behind other layers at icon-offset and icon-translate has icons rendered behind other layers Jan 3, 2016
@peterqliu
Copy link
Contributor

This seems like a dupe of #757, so I will close for now. Feel free to reopen if it is distinct.

@averas
Copy link
Contributor Author

averas commented Jan 15, 2016

This was supposedly fixed as part of #757 and released with v0.12.3 but still occurs, so it was not the same issue. Please reopen or confirm that icon offset/translate is not meant to be used this way.

To reproduce, have a symbol layer with:

"paint": { "icon-translate": [-25, 0] }

@bhousel bhousel reopened this Jan 15, 2016
@averas
Copy link
Contributor Author

averas commented Jan 15, 2016

http://codepen.io/anon/pen/yezaGy

Zoom in on the symbol until it flips under a tile edge .. then out again.

@averas
Copy link
Contributor Author

averas commented Jan 15, 2016

This may somehow be related to the GeoJSON source and perhaps geojson-vt because even though I got the impression I saw traces of similar behaviour when restyling symbols in the regular streets vector tiles I had a hard time reproducing the exact same behaviour there.

@mourner ?

@averas
Copy link
Contributor Author

averas commented Jan 15, 2016

Okay, perhaps the problem was quite obvious.. just setting icon-allow-overlap and icon-ignore-placement to false mitigates the problem. The reason I had one if these set to true was, however, that I wanted to have the symbols in this particular layer to be able to rendered on top of each other, but it seems I have to choose.

I've updated the codepen. It seems there is no way to have the symbols being able to overlap each other without having the symbols sliding in under tile edges..

http://codepen.io/anon/pen/VeMPyL

@lucaswoj
Copy link
Contributor

This behavior was not fixed by #757.

The relevant bit of code is in draw_symbol

There's no easy way to prevent drawing the symbols twice (once in each overlapped tile).

bhousel added a commit that referenced this issue Jan 16, 2016
@ansis
Copy link
Contributor

ansis commented Jan 20, 2016

The real solution will be to make your style possible without -ignore-placement or -allow-overlap, but a temporary workaround is to increase the buffer size of the geojson tiles created internally.

Maybe try setting "buffer" to 500 or even bigger:

 map.addSource("markers", {
        "type": "geojson",
        "buffer": 500,
        "data": {

@averas
Copy link
Contributor Author

averas commented Jan 20, 2016

@ansis Ah, thanks for that!

Am I then correct in my assumption that this is related to the GeoJSON source itself? I took my data and served it with vector tiles instead and did not see traces of the same behaviour (although I didn't really test it thoroughly)..

@ansis
Copy link
Contributor

ansis commented Jan 20, 2016

Yes, it's mostly a geojson issue. The equivalent buffer parameter in vectortiles is much larger by default.

@ansis
Copy link
Contributor

ansis commented Mar 31, 2016

The default buffer size was increased in #2026

@ansis ansis closed this as completed Mar 31, 2016
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

5 participants