---
title: "<ScriptLeafletGeoJson>"
description: "Adds inline GeoJSON through L.geoJSON. Replacing data clears and repopulates the existing layer; changing options.style updates its path style."
canonical_url: "https://scripts.nuxt.com/scripts/leaflet/api/geojson"
last_updated: "2026-08-11T04:27:02.228Z"
---

Adds inline GeoJSON through `L.geoJSON`. Replacing `data` clears and repopulates the existing layer; changing `options.style` updates its path style.

<script-types filter="ScriptLeafletGeoJson" script-key="leaflet">



</script-types>

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.
