L.esri.Tasks.IdentifyFeatures
L.esri.Tasks.IdentifyFeatures is an abstraction for the Identify API that exists on Map Services. It provides a chainable API for building request parameters and executing the request.
Constructor
| Constructor |
Description |
new L.esri.Tasks.IdentifyFeatures(<MapService> endpoint, <Object> options)
L.esri.Tasks.identifyFeatures(<MapService> endpoint, <Object> options)
new L.esri.Tasks.IdentifyFeatures(<String> endpoint, <Object> options)
L.esri.Tasks.identifyFeatures(<String> endpoint, <Object> options)
|
The endpoint parameter is the service that you want to identify either an ArcGIS Server or ArcGIS Online service. You can also pass the URL to a service directly as a string. See service URLs for more information on how to find these URLs. |
Options
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('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