Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async () => {
async function search(
provider: BaseProvider,
options = { query: 'Where is my home?' },
) {
return provider.search(options);
}
[
await search(new OpenStreetMapProvider()),
await search(new BingProvider({ key: 'BING_API_KEY' })),
await search(new EsriProvider()),
await search(new GoogleProvider({ key: 'GOOGLE_MAPS_API_KEY ' })),
].forEach(([{ x, y, bounds, label, raw }]) => ({ x, y, bounds, label, raw }));
})();
import L from 'leaflet';
import {
GeoSearchControl,
BingProvider,
} from 'leaflet-geosearch';
const provider = new BingProvider({ params: {
key: '__YOUR_BING_KEY__'
} });
const searchControl = new GeoSearchControl({
provider: provider,
});
const map = new L.Map('map');
map.addControl(searchControl);