Map Tiles
Leaflet
Tutorial on how to use Leaflet JS to create a map in a web page with Solvice Maps.
1
Install Leaflet
npm install --save leaflet
2
Install MapLibre
Unfortunately, we need the MapLibre GL JS library to handle the rendering of the map. You can install it using the following command:
npm install --save maplibre-gl
3
Create Solvice Account
Copy the API key.
4
Choose a Solvice style
Do you prefer a light or dark theme? Choose one of the following styles: light
, dark
or color
.
L.maplibreGL({
style: 'https://cdn.solvice.io/styles/light.json', // Style URL; see our documentation for more options
}).addTo(map);
5
Add API key
style: 'https://cdn.solvice.io/styles/light.json?key=API_KEY'
And change API_KEY with your own key.