Maplibre
User location on a dynamic Maplibre map
Maplibre
User location on a dynamic Maplibre map
User location on a dynamic Maplibre map
GeoJSON Linelayer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Display a Solvice Map on a webpage: location</title>
<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>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
const map = new maplibregl.Map({
container: "map",
hash: true,
center: [-122.4194, 37.7749],
zoom: 12,
style: 'https://cdn.solvice.io/styles/light.json',
});
// Add geolocate control to the map.
map.addControl(
new maplibregl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true
},
trackUserLocation: true
})
);
</script>
</body>
</html>