How to use the esri-leaflet-geocoder.Controls function in esri-leaflet-geocoder

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))
  }
})

esri-leaflet-geocoder

Esri Geocoding utility and search plugin for Leaflet.

Apache-2.0
Latest version published 2 months ago

Package Health Score

87 / 100
Full package analysis