L.esri.Tasks.IdentifyFeatures

L.esri.Tasks.IdentifyFeatures is an abstraction for the Identify API found in Map Services. It provides a chainable API for building request parameters and executing the request.

Constructor

Constructor Description
L.esri.Tasks.identifyFeatures(<ImageService> endpoint)

L.esri.Tasks.identifyFeatures(<Object> options)
Accepts either an options object or an instance of .

Options

Option Type Default Description
url String '' URL of the ArcGIS service you would like to consume.
proxy String false URL of an ArcGIS API for JavaScript proxy or ArcGIS Resource Proxy to use for proxying POST requests.
useCors Boolean true If this task should use CORS when making GET requests.

Methods

Method Returns Description
on(<Map> map) this The map to identify features on.
at(<LatLng> latlng) this Identifies feautres at a given LatLng
layerDef(<Integer> id, <String> where) this Add a layer definition to the query.
between(<Date> from, <Date> to) this Identifies features within a given time range.
layers(<String> layers) this The string representing which layers should be identified.
precision(<Integer> precision) this Return only this many decimal points of precision in the output geometries.
tolerance(<Integer> precision) this Buffer the identify area by a given number of screen pixels.
returnGeometry(<Boolean> returnGeometry) this Return geometry with results. Default is true.
simplify(<Map> map, <Integer> factor) this Simplify the geometries of the output features for the current map view. the factor parameter controls the amount of simplification between 0 (no simplification) and 1 (simplify to the most basic shape possible).
token(<String> token) this Adds a token to this request if the service requires authentication. Will be added automatically if used with a service.
run(<Function> callback, <Object> context) this Executes the identify request with the current parameters, identified features will be passed to callback as a GeoJSON FeatureCollection. Accepts an optional function context

Example

var map = new L.Map('map').setView([ 45.543, -122.621 ], 5);

L.esri.Tasks.identifyFeatures({
    url: 'http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer'
})
.on(map)
.at([45.543, -122.621])
.layers('visible:1')
.run(function(error, featureCollection, response){
    console.log("UTC Offset: " + featureCollection.features[0].properties.ZONE);
});

Edit this page on GitHub