By default it will use OpenStreetMaps tiles, but it can be configured to use a different provider, such as Mapbox.
Using MapBox (streets style)
sanity install leaflet-input
Note: If you have another geopoint input installed (such as
@sanity/google-maps-input), you'll either need to move this plugin below it in your studios
plugins array (easiest), or explicitly importing the input component where you want to use it.
The plugin can be configured both "globally" and "locally".
The global options can be defined in
The same options can be defined on a field level ("local"):
// some-schema-type.jsname: 'restaurant'type: 'document'fields:name: 'location'type: 'geopoint'options:leaflet:defaultLocation:lat: 59924095lng: 10758458
In your studios
config/leaflet-input.json file (if it's missing, run
sanity start to generate it):
Read more about access tokens here.
Importing the component
If you have multiple Geopoint inputs installed, you may need to import the leaflet plugin specifically in the cases where you want to use it:
// some-schema-type.jsname: 'restaurant'type: 'document'fields:name: 'location'type: 'geopoint'inputComponent: LeafletGeopointInput
MIT © Espen Hovlandsdal