🚀 New /route/batch endpoint! Learn more
/route/batch
Tutorial on how to use MapLibre GL JS to create a map in a web page with Solvice Maps.
Install Maplibre
npm install maplibre-gl
Create Solvice Account
Choose a Solvice style
light
dark
color
var map = new maplibregl.Map({ container: "map", hash: true, center: [-122.4194, 37.7749], zoom: 12, style: 'https://cdn.solvice.io/styles/light.json', });
Add API key
style: 'https://cdn.solvice.io/styles/light.json?key=API_KEY'
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title>Display a Solvice Map on a webpage</title> <link href="data:image/png;base64,iVBORw0KGgo=" rel="icon" type="image/png"/> <meta content="initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport"/> <link href="https://unpkg.com/maplibre-gl@4.1.0/dist/maplibre-gl.css" rel="stylesheet"/> <script src="https://unpkg.com/maplibre-gl@4.1.0/dist/maplibre-gl.js"></script> <style> #map { position: absolute; top: 0; bottom: 0; width: 100%; } </style> </head> <body> <div id="map"></div> <script> var map = new maplibregl.Map({ container: "map", hash: true, center: [-122.4194, 37.7749], zoom: 12, style: 'https://cdn.solvice.io/styles/light.json', }); </script> </body> </html>