How to use the leaflet-control-geocoder/src.photon function in leaflet-control-geocoder

To help you get started, we’ve selected a few leaflet-control-geocoder 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 mapcontrib / mapcontrib / public / js / view / geocodeWidget.js View on Github external
const left = bounds._southWest.lng;
    const top = bounds._northEast.lat;
    const right = bounds._northEast.lng;
    const bottom = bounds._southWest.lat;
    const { lat, lng } = this._radio.reqres.request('map:currentCenter');

    switch (this.model.get('geocoder')) {
      case CONST.geocoder.nominatim:
        return leafletControlGeocoder.nominatim({
          geocodingQueryParams: {
            viewbox: `${left},${top},${right},${bottom}`,
            'accept-language': lang
          }
        });
      default:
        return leafletControlGeocoder.photon({
          geocodingQueryParams: {
            lat,
            lon: lng,
            lang
          }
        });
    }
  }
});

leaflet-control-geocoder

Extendable geocoder with builtin support for OpenStreetMap Nominatim, Bing, Google, Mapbox, MapQuest, What3Words, Photon, Pelias, HERE, Neutrino, Plus codes

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis