From 008e03493204da2fbf743f990433eb5b20eb9b79 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Tue, 25 Aug 2026 15:18:55 +0200 Subject: [PATCH] Add geolocate control to the map Lets the user center the map on their current location, with an accuracy circle and continuous tracking. --- public/js/map.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/js/map.js b/public/js/map.js index c9d436d..201cabb 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -1,6 +1,7 @@ import { Map as MaplibreMap, NavigationControl, + GeolocateControl, addProtocol, } from "/vendor/maplibre-gl/maplibre-gl.mjs"; import { RadarControl } from "/js/radar.js"; @@ -70,6 +71,14 @@ const map = new MaplibreMap({ }); map.addControl(new NavigationControl(), "top-right"); +map.addControl( + new GeolocateControl({ + positionOptions: { enableHighAccuracy: true }, + trackUserLocation: true, + showAccuracyCircle: true, + }), + "top-right", +); map.addControl(new RadarControl(map), "top-right"); const layerToggle = new LayerToggleControl(applyStyle);