API / Controls
GeolocateControl
Add the MapLibre geolocate control to the map. This control shows a button that moves the map to the location of the user.
Put it inside the MapLibre component. The component uses the props only when it creates the control. Changes to the props after that have no effect. Bind to control to get the GeolocateControl instance, for example to call trigger() on it. If you supply a control, the component adds that control and does not make a new one.
import { GeolocateControl } from 'svelte-maplibre'; Examples
Props
- position
maplibregl.ControlPositionDefault:
'top-left' - positionOptions
PositionOptions - fitBoundsOptions
maplibregl.FitBoundsOptions - trackUserLocation
booleanDefault:
false - showAccuracyCircle
booleanDefault:
true - showUserLocation
booleanDefault:
true
Source: src/lib/GeolocateControl.svelte