Get Pixels within Geometry from PixelBlock (JSAPI 4.X)

329
2
Jump to solution
12-02-2019 02:49 AM
LukasWürsch
New Contributor III

Hi,

With the PixelBlock class, it is possible to access pixels from an imagery layer from the client side (for example like this ImageryLayer - client side pixel filter | ArcGIS API for JavaScript 4.13 ). Is it possible to 'clip' or 'filter' a pixelBlock, so only the pixels are returned which are within a geometry?

What I have in mind is something like this:

pixelsInGeometry = pixelData.pixelBlock.clip(geometry)

... but I did not find a method in the PixelBlock class to achieve this. 

I would highly appreciate any ideas of suggestions.

Kind Regards

Lukas

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

Client side clipping is not possible for ImageryLayer. Most likely you know that the clipping can be done on the server side. But just in case, I am including this info.  You can clip the images on the server side by setting ImageryLayer's renderingRule. As you can see from this image service REST doc, the clip is one of the supported raster functions on image services. 

Hope this helps,

-Undral

View solution in original post

2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

Client side clipping is not possible for ImageryLayer. Most likely you know that the clipping can be done on the server side. But just in case, I am including this info.  You can clip the images on the server side by setting ImageryLayer's renderingRule. As you can see from this image service REST doc, the clip is one of the supported raster functions on image services. 

Hope this helps,

-Undral

LukasWürsch
New Contributor III

Thank you for clarifying that clipping is not possible on the client. Also thanks for the hint about the Raster Functions.

If you allow me a follow-up question: Is it possible to summarize 'statistics' of an image layer within a user supplied geometry (ideally on the client side)? This example brought me on the idea, but maybe it is not possible.

Else I believe I can do that with the rest API like this

0 Kudos