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

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

Options

OptionTypeDefaultDescription
urlString''URL of the ArcGIS service you would like to consume.
proxyStringfalseURL of an ArcGIS API for JavaScript proxy or ArcGIS Resource Proxy to use for proxying POST requests.
useCorsBooleantrueIf this task should use CORS when making GET requests.

Methods

MethodReturnsDescription
at(<LatLng>latlng)thisIdentifie the pixel value at a given LatLng
between(<Date>from, <Date>to)thisIdentifies pixel values within a given time range.
getRenderingRule()ObjectReturns the current rendering rule of the task.
setRenderingRule(<Object>renderingRule)thisSets the rendering rule to apply when getting a pixel value.
getMosaicRule()ObjectReturns the current mosaic rule of the task.
setMosaicRule(<Object>mosaicRule)thisSets the mosaic rule to apply when getting a pixel value.
setPixelSize(<Array>pixelSize or <String>pixelSize)thisSets 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()ObjectReturns the current pixel size of the task.
returnCatalogItems(<Boolean>returnCatalogItems)thisIndicates 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)thisReturn catalog footprints (geometry) with catalog item results. Default is `false`.
token(<String>token)thisAdds a token to this request if the service requires authentication. Will be added automatically if used with a service.
run(<Function>callback, <Object>context)thisExecutes 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

Use dark colors for code blocksCopy
              
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);
});

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