How to use esri-leaflet-geocoder - 2 common examples

To help you get started, we’ve selected a few esri-leaflet-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 Esri / developer-support / web-leaflet / browserify / main.js View on Github external
var L = require('leaflet')
var Esri = require('esri-leaflet')
var Geocoding = require('esri-leaflet-geocoder')

// https://github.com/Leaflet/Leaflet/issues/766
L.Icon.Default.imagePath = 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.5/images'

var map = L.map('map').setView([37.75, -122.23], 10)
Esri.basemapLayer('Topographic').addTo(map)

var searchControl = Geocoding.Controls.geosearch().addTo(map)
  
var results = L.layerGroup().addTo(map)

searchControl.on('results', function(data){
  results.clearLayers()
  for (var i = data.results.length - 1; i >= 0; i--) {
    results.addLayer(L.marker(data.results[i].latlng))
  }
})
github tooleks / photo-blog / app / resources / js / components / map / locationPopupProvider.js View on Github external
return new Promise((resolve) => {
        reverseGeocode()
            .latlng(location)
            .run((error, result) => {
                let address;
                if (!error) {
                    address = result.address.LongLabel;
                }
                const propsData = {lat: location.lat, lng: location.lng, address};
                const popup = new LocationPopupComponent({propsData});
                const html = popup.$mount().$el.outerHTML;
                resolve(html);
            });
    });
}

esri-leaflet-geocoder

Esri Geocoding utility and search plugin for Leaflet.

Apache-2.0
Latest version published 1 month ago

Package Health Score

87 / 100
Full package analysis