This content has moved to developers.arcgis.com. Please update your bookmarks!
L.esri.IdentifyFeatures
Extends L.esri.Task
L.esri.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.identifyFeatures(<MapService> L.esri.identifyFeatures(<Object> |
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> |
this |
The map to identify features on. |
at(<Geometry> |
this |
Identifies features at a given LatLng. geometry can also be an instance of L.Marker , L.Polygon , L.Polyline , L.LatLngBounds , L.GeoJSON or a valid GeoJSON object literal. |
layerDef(<Integer> |
this |
Add a layer definition to the query. |
between(<Date> |
this |
Identifies features within a given time range. |
layers(<String> |
this |
By default, all features will be identified, but it is possible to specify both an alternative strategy and array of individual layers. See the REST API documentation for more information about valid combinations. ex: .layers('all:0') .
|
precision(<Integer> |
this |
Used to cap the number of decimal points included in output geometries. |
tolerance(<Integer> |
this |
Buffer the identify area by a given number of screen pixels. |
returnGeometry(<Boolean> |
this |
Return geometry with results. Default is true . |
simplify(<Map> |
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 (the most basic shape possible). |
format(<Boolean> |
this |
Use false to ensure that the server returns unformatted feature attributes.Only available for ArcGIS Server 10.5+. |
token(<String> |
this |
Adds a token to this request if the service requires authentication. Will be added automatically if used with a service. |
run(<Function> |
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.identifyFeatures({
url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer'
})
.on(map)
.at([45.543, -122.621])
.layers('visible:1')
.run(function (error, featureCollection, response) {
if (error) {
console.log(error);
return;
}
console.log('UTC Offset: ' + featureCollection.features[0].properties.ZONE);
});