Skip to content

Commit

Permalink
Merge pull request #99 from radical-data/user-geolocation
Browse files Browse the repository at this point in the history
Add geolocate control
  • Loading branch information
rayenjaramitrovich authored Sep 25, 2024
2 parents 5c1bb4a + 1f416c1 commit 9e90370
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
type MapMouseEvent,
type MapGeoJSONFeature
} from 'maplibre-gl';
const { Map, NavigationControl, Popup } = maplibregl;
const { Map, NavigationControl, Popup, GeolocateControl } = maplibregl;
import 'maplibre-gl/dist/maplibre-gl.css';
import markerImage from '$lib/assets/marker.png';
import markerHoveredImage from '$lib/assets/marker-hovered.png';
Expand Down Expand Up @@ -94,6 +94,14 @@
new NavigationControl({ showCompass: false }),
'bottom-right'
);
map.addControl(
new GeolocateControl({
positionOptions: {
enableHighAccuracy: true
}
}),
'bottom-right'
);
map.keyboard.enable();
map.on('load', async () => {
Expand Down

0 comments on commit 9e90370

Please sign in to comment.