Open this example in the interactive library
Live preview
Source code
// components/GeoJSONPointDownload.tsx
export default function GeoJSONPointDownload({
lat = 43.65,
lon = -79.38,
}: { lat?: number; lon?: number } = {}) {
const data = JSON.stringify({ type: "Point", coordinates: [lon, lat] });
return (
<a
download="point.geojson"
href={"data:application/geo+json," + encodeURIComponent(data)}
>
Save map point
</a>
);
}
