L.esri.IdentifyImage

Extends L.esri.Task

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

Constructor

Constructor Description
L.esri.identifyImage(<ImageService> endpoint)

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

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
at(<LatLng> latlng) this Identifie the pixel value at a given LatLng
between(<Date> from, <Date> to) this Identifies pixel values within a given time range.
getRenderingRule() Object Returns the current rendering rule of the task.
setRenderingRule(<Object> renderingRule) this Sets the rendering rule to apply when getting a pixel value.
getMosaicRule() Object Returns the current mosaic rule of the task.
setMosaicRule(<Object> mosaicRule) this Sets the mosaic rule to apply when getting a pixel value.
setPixelSize(<Array> pixelSize or <String> pixelSize) this Sets the pixel size to use when getting a pixel value. Either an array ([x,y]) or string ('x,y'). If not set, it will use the pixel size defined by the service.
getPixelSize() Object Returns the current pixel size of the task.
returnCatalogItems(<Boolean> returnCatalogItems) this Indicates whether or not to return raster catalog items. Set it to false when catalog items are not needed to improve the identify operation's performance significantly. When set to false, neither the geometry nor attributes of catalog items will be returned. Default is false.
returnGeometry(<Boolean> returnGeometry) this Return catalog footprints (geometry) with catalog item results. Default is false.
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 pixel value will be passed to callback as a GeoJSON Point. Accepts an optional function context

Example

L.map('map').setView([36.230577, -118.253147], 10);

L.esri.identifyImage({
  url: 'https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer'
})
  .at([36.230577, -118.253147])
  .pixelSize([30, 30])
  .run(function (error, identifyImageResponse, rawResponse) {
    if (error) {
      console.log(error);
      return;
    }
    console.log(identifyImageResponse.pixel.properties.value);
  });

Edit this page on GitHub