Mapbox-gl-js: addLayer: layout.icon-allow-overlap is ignored

Created on 14 Dec 2016  路  6Comments  路  Source: mapbox/mapbox-gl-js

I'm adding a layer of hotel icons, like this:
````
this.map.addLayer({
'id': 'hotels',
'type': 'symbol',
'source': 'hotels',
'layout': {
'icon-image': "icon-hotel",
'icon-size': 0.2,
'icon-allow-overlap': true
},

});

````
mapbox-gl-js version: 0.28.0

However, when I zoom out, I only see one marker. When I zoom in, I see more and more icons.
I want to see all icons, no matter what the zoom level is.

I don't see any difference between icon-allow-overlap true or false.

Expected Behavior

When zooming out, I expect to see all markers

Actual Behavior

Only when I zoom in, I see all markers.

Most helpful comment

ah, this isn't obvious from the documentation, but each symbol consists of an optional icon (the graphical sprite) and an optional text (the label). To disable collision behavior for symbols (i.e. "get all of them to show"), we must allow overlap of both text and icons (documentation).

Add text-allow-overlap:true to your fiddle, and voila:

screen shot 2016-12-14 at 10 08 50 am

@rolandoldengarm

All 6 comments

@rolandoldengarm can you provide a test case?

Yes, I've got a Fiddle. However, it contains our custom style plus our API key... Can I share this privately somehow? @peterqliu

/edit: I'll email it to you :)

ah, this isn't obvious from the documentation, but each symbol consists of an optional icon (the graphical sprite) and an optional text (the label). To disable collision behavior for symbols (i.e. "get all of them to show"), we must allow overlap of both text and icons (documentation).

Add text-allow-overlap:true to your fiddle, and voila:

screen shot 2016-12-14 at 10 08 50 am

@rolandoldengarm

Thanks for digging in @peterqliu. Closing here since this is expected behavior, but I'll make a note in https://github.com/mapbox/mapbox-gl-style-spec/issues/405.

Thanks @peterqliu this works :)

This doesn't work anymore. How to have this behavior again ?

Was this page helpful?
0 / 5 - 0 ratings