L.esri.Geocoding.Suggest

Extends L.esri.Task

L.esri.Geocoding.Suggest is an abstraction for submitting requests for geocoding suggestions. You can find more information and the source code for this plugin here.

Constructor

Constructor Description
L.esri.Geocoding.suggest(<Object> options)

Creates a new Suggest task

You can pass any options you can pass to L.esri.Task. The url will be the ArcGIS World Geocoder by default but a custom geocoding service can also be used.

Methods

Method Returns Description
text(<String> text) this The text to get suggestions for.
category(<String> category) this The optional category to search for. A list of valid categories can be found here.
within(<L.LatLngBounds> bounds) this A bounding box used to filter results.
nearby(<L.LatLng> latlng, <Integer> distance) this Increase the match score of candidates close to a location passed within the request.
run(<Function> callback, <Object> context) XMLHttpRequest Executes the request chain and accepts the response callback.

Examples

<link rel="stylesheet" href="./esri-leaflet-geocoder.css">
<script src="./esri-leaflet-geocoder.js"></script>
L.esri.Geocoding.suggest()
  .text('trea')
  .nearby([45, -121], 5000)
  .run(function (error, response) {
    /* response syntax is documented here:
    https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm#ESRI_SECTION1_FC3884A45AD24E62BD11C9888F1392DB
    */
  });

Edit this page on GitHub