mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-05-20 14:44:51 +02:00
fix(map): Fix state labels by using coalesce fallback for text-field
The protomaps theme generates text-field expressions using name:short, but the PMTiles data doesn't have that property. States have 'ref' (e.g. 'CA', 'ON') and 'name' (e.g. 'California', 'Ontario'). - Use coalesce expression: name:short -> ref -> name - Expand zoom ranges slightly: country z1-5, region z4-8 - Verified fix in built JS before deployment Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5fcd6cda9a
commit
bb164965ef
1 changed files with 10 additions and 2 deletions
|
|
@ -272,10 +272,18 @@ function applyBaseLabelStyling(map) {
|
|||
// - Cities: unchanged (natural min_zoom in tile data)
|
||||
try {
|
||||
if (map.getLayer('places_country')) {
|
||||
map.setLayerZoomRange('places_country', 1, 4)
|
||||
map.setLayerZoomRange('places_country', 1, 5)
|
||||
}
|
||||
if (map.getLayer('places_region')) {
|
||||
map.setLayerZoomRange('places_region', 4, 7)
|
||||
map.setLayerZoomRange('places_region', 4, 8)
|
||||
// FIX: The protomaps theme uses name:short which doesn't exist in tiles
|
||||
// Use coalesce to fall back to ref (e.g., "CA") then name (e.g., "California")
|
||||
map.setLayoutProperty('places_region', 'text-field', [
|
||||
'coalesce',
|
||||
['get', 'name:short'],
|
||||
['get', 'ref'],
|
||||
['get', 'name']
|
||||
])
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore if layers don't exist
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue