Skip to main content
Api

<ScriptMapLibreGeoJson>

Adds a GeoJSON source and one or more MapLibre style layers. Replacing data updates the existing source; changing layer or source options rebuilds resources in a controlled order.

Changing source-id removes the previously owned source and layers before recreating them under the new ID.

Each layer gets the component's source-id unless it explicitly supplies another source. The component also restores its source and layers after the map style changes.

Remote fetching is intentionally outside the component. Fetch and validate data with useFetch, then pass the resulting object to data so loading and failure states remain explicit.

Was this page helpful?