How to use the leaflet-geosearch.GoogleProvider function in leaflet-geosearch

To help you get started, we’ve selected a few leaflet-geosearch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / leaflet-geosearch / leaflet-geosearch-tests.ts View on Github external
(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 }));
})();
github smeijer / leaflet-geosearch / docs / snippets / google.js View on Github external
import L from 'leaflet';
import {
  GeoSearchControl,
  GoogleProvider,
} from 'leaflet-geosearch';

const provider = new GoogleProvider({ params: {
  key: '__YOUR_GOOGLE_KEY__',
} });

const searchControl = new GeoSearchControl({
  provider: provider,
});

const map = new L.Map('map');
map.addControl(searchControl);

leaflet-geosearch

Adds support for address lookup (a.k.a. geocoding / geoseaching) to Leaflet.

MIT
Latest version published 3 months ago

Package Health Score

80 / 100
Full package analysis