Reputation: 1
I have some very high resolution contour lines generated from topographic data which is in the form of GeoJSON MultiLineStrings. I upload and create a vector tile using Mapbox Tile Service Tilesets CLI and add the source and layer to a map as shown below.
The issue is that the contour line labels are disappearing far before my minzoom value, which is specified in the tileset recipe and the layer. Appreciate any help!
**The recipe is simple. **
{
"version": 1,
"layers": {
"bathy_cont_layer": {
"source": "mapbox://tileset-source/USER_PLACEHOLDER/TILESET_PLACEHOLDER",
"minzoom": 5,
"maxzoom": 12,
"features": {
"simplification": {
"distance": 0
}
}
}
}
}
**The tileset is added to my map by **
map.addSource('bathy_cont_source', {
type: 'vector',
url: 'mapbox://USER_PLACEHOLDER.TILESET_PLACEHOLDER'
});
**The layer is added by **
map.addLayer({
'id': 'bathy_cont_line',
'type': 'line',
'source': 'bathy_cont_source',
'source-layer': 'bathy_cont_layer',
'layout': {
'visibility': 'visible',
},
'paint': {
'line-color': '#000000',
'line-width': ['interpolate',['linear'],['zoom'],7,2,10,3],
}
},
);
The GeoJSON has an attribute "title" for the contour labels
**The text on the lines is added by **
map.addLayer({
'id': 'bathy_cont_text',
'type': 'symbol',
'source': 'bathy_cont_source',
'source-layer': 'bathy_cont_layer',
'minzoom': 5,
'maxzoom': 12,
'layout': {
'text-field': ['get','title'],
'symbol-placement': 'line',
'text-size': ['interpolate',['linear'],['zoom'],5,10,12,14],
'symbol-spacing':['interpolate',['linear'],['zoom'],5,100,12,10],
'text-font': ['Open Sans Semibold', 'Arial Unicode MS Bold'],
'icon-allow-overlap': true,
'text-allow-overlap': true,
'icon-ignore-placement': true,
'text-ignore-placement': true,
'text-justify': 'auto',
'visibility': 'visible'
},
'paint': {
'text-color': '#FFFFFF',
'text-halo-color': '#000000',
'text-halo-width': 2
}
},
);
Contour labels disappearing at slightly lower zoom
I don't have this issue when the resolution of the contour lines is much lower. I have tried reducing the text size with a constant value and also reducing symbol spacing with a constant value with no luck. I was expecting contour labels to remain on the map at lower zoom.
Upvotes: 0
Views: 31