Leaflet GeoSearch
Edit page
IntroductionUsageLeaflet Control
Providers

OpenCage Provider

note: OpenCage services require an API key. Obtain here. For more options and configurations, see the OpenCage developer docs.

import { OpenCageProvider } from 'leaflet-geosearch';
const provider = new OpenCageProvider({
params: {
key: '__YOUR_OPENCAGE_KEY__',
},
});
// add to leaflet
import { GeoSearchControl } from 'leaflet-geosearch';
map.addControl(
new GeoSearchControl({
provider,
style: 'bar',
}),
);