I have JSON icons on my map and they disappear as I zoom out from them when they are close together. (I am guessing to avoid cluttering). I would like to keep them though - even if they somehow overlap - as these icons are used for analysis. I can't find documentation to avoid this. Below is an example screenshot - and my code to display the JSON points.
Screenshot :
Current code (entire function as there is not much to it - simple):
function addMDA_toA(){
topleftmapbox.loadImage('images/MDA.png', function(error, image) {
if (error) throw error;
topleftmapbox.addImage('meso-image', image);
});
var url = 'json/MDA.json';
window.setInterval(function() {
topleftmapbox.getSource('mesocyclone').setData(url);
}, 2000);
topleftmapbox.addSource('mesocyclone', { type: 'geojson', data: url });
topleftmapbox.addLayer({
"id": "mesocyclone",
"type": "symbol",
"source": "mesocyclone",
"layout": {
"icon-image": "meso-image"
}
});
}
When adding the layer, the following layout attributes must be true:
"icon-allow-overlap" : true,
"text-allow-overlap": true
Without both of these set to true, the issue will not be resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With