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

ConstructorDescription
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 Geocoding service by default but a custom geocoding service can also be used.

Methods

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

Examples

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
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/suggest/#response-details
    */
    });

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.