MapLibre GL Geocoder
A geocoder control for maplibre-gl-js.
Usage
A full working example can be found here, which uses Nominatim:
https://maplibre.org/maplibre-gl-js/docs/examples/geocoder/
Usage with a module bundler
npm install --save @maplibre/maplibre-gl-geocoder
import MaplibreGeocoder from '@maplibre/maplibre-gl-geocoder';
import '@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css';
...
var Geo = {
forwardGeocode: async (config) => { },
reverseGeocode: async (config) => { },
getSuggestions: async (config) => { },
searchByPlaceId: async (config) => { }
};
const geocoder = new MaplibreGeocoder(Geo, { maplibregl: maplibregl });
map.addControl(geocoder);
Using without a Map
It is possible to use the plugin without it being placed as a control on a maplibre-gl map.
Deeper dive
API Documentation
See here for complete reference.
Also check out the example in MapLibre docs:
https://maplibre.org/maplibre-gl-js/docs/examples/geocoder/
Contributing
See CONTRIBUTING.md.
Licence
ISC © MapLibre © Mapbox