Skip to content

Instantly share code, notes, and snippets.

@gtnbssn
Created May 20, 2022 02:09
Show Gist options
  • Save gtnbssn/2176a76c77ba54f5073ba48bcf9a4751 to your computer and use it in GitHub Desktop.
Save gtnbssn/2176a76c77ba54f5073ba48bcf9a4751 to your computer and use it in GitHub Desktop.
---
import XElement from 'astro-xelement';
import { Debug } from 'astro/components';
const { Div } = XElement;
---
<Div id="map" style="position: absolute; top: 0; bottom: 0; width: 100%;"
@do={(element,store)=>{
import maplibregl from 'maplibre-gl';
import 'maplibre-gl/dist/maplibre-gl.css';
store.map = new maplibregl.Map({
container: 'map', // container id
style: 'https://demotiles.maplibre.org/style.json', // style URL
center: [0, 0], // starting position [lng, lat]
zoom: 1 // starting zoom
}}
></Div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment