mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-05-20 14:44:51 +02:00
fix: use correct protomaps-themes-base v4 API for layer generation
layersWithCustomTheme() expects a Theme object as its second argument,
not a string key. Passing "dark" (string) caused all layer paint
properties to be empty objects — rendering tiles invisibly on black
background. Switched to layers(source, namedTheme("dark"), {lang:"en"})
which is the canonical v4 API. Added v4 sprite URL for POI icons.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ecdfedb98d
commit
ce32014896
1 changed files with 3 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ import { useEffect, useRef } from 'react'
|
||||||
import maplibregl from 'maplibre-gl'
|
import maplibregl from 'maplibre-gl'
|
||||||
import 'maplibre-gl/dist/maplibre-gl.css'
|
import 'maplibre-gl/dist/maplibre-gl.css'
|
||||||
import { Protocol } from 'pmtiles'
|
import { Protocol } from 'pmtiles'
|
||||||
import { layersWithCustomTheme } from 'protomaps-themes-base'
|
import { layers, namedTheme } from 'protomaps-themes-base'
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const mapContainer = useRef(null)
|
const mapContainer = useRef(null)
|
||||||
|
|
@ -16,6 +16,7 @@ export default function App() {
|
||||||
style: {
|
style: {
|
||||||
version: 8,
|
version: 8,
|
||||||
glyphs: 'https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf',
|
glyphs: 'https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf',
|
||||||
|
sprite: 'https://protomaps.github.io/basemaps-assets/sprites/v4/dark',
|
||||||
sources: {
|
sources: {
|
||||||
protomaps: {
|
protomaps: {
|
||||||
type: 'vector',
|
type: 'vector',
|
||||||
|
|
@ -23,7 +24,7 @@ export default function App() {
|
||||||
attribution: '<a href="https://protomaps.com">Protomaps</a> | <a href="https://openstreetmap.org">OSM</a>',
|
attribution: '<a href="https://protomaps.com">Protomaps</a> | <a href="https://openstreetmap.org">OSM</a>',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
layers: layersWithCustomTheme('protomaps', 'dark'),
|
layers: layers('protomaps', namedTheme('dark'), { lang: 'en' }),
|
||||||
},
|
},
|
||||||
center: [-114.5, 44.0],
|
center: [-114.5, 44.0],
|
||||||
zoom: 6,
|
zoom: 6,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue