Raster Layer > Query for Extent

299
2
11-26-2019 08:02 AM
MatthieuThery1
Occasional Contributor

Hi,

Is it possible to query for extent a Raster Layer (as a MapImageLayer sublayer) ?

For other types of sublayers I'm using QueryTask and the executeForExtent method and it works ok (below), however I'm getting an error when querying Raster Layers "{"error":{"code":400,"message":"Invalid or missing input parameters.","details":[]}}". I have tried various combination of queries to no avail.

As an example how would you query fo extent the hillshade raster in this sandbox example? ArcGIS API for JavaScript Sandbox  , when looking at the rest endpoint it has "Supports Returning Query Extent: true" , so it might be possible?

const query = new Query({
   outSpatialReference: spatialReference.wkid,
   geometry: view.extent
});
const queryTask2 = new QueryTask({
   url
});
queryTask2.executeForExtent(query)
0 Kudos
2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

QueryTask is returning an error because ImageService REST end point does not support `returnExtentOnly` option with Query operation. The SDK document for executeForExtent explains this method only works for feature services and map service layers. 

Hope this helps,

-Undral

0 Kudos
MatthieuThery1
Occasional Contributor

Yes that's a map service layer I'm trying to query for extent.

0 Kudos