Client Side Image Service Filtering

1102
2
06-17-2017 06:38 PM
SimonJackson
Occasional Contributor III

I want to replicate this amazing Raster Layer Sample with my own image service.  My image service (paste of REST details) is not multidimensional, and is from a mosaic dataset containing one raster dataset which has a value between 0-100. This image service performs fast when viewing in the Map Viewer.

Here is a JSFiddle of my modified sample, but using a public image service.  

 

The initial load of the app is sluggish (even more so with my image service).

Something that does not happen with the above sample, but happens with my service is I keep getting errors in the console.  I am having trouble trying to identify what the problem is here, sure it is simple.  

Let me know if you need more info from my end.

init.js:113 TypeError: Cannot read property '0' of undefined
at Object.maskPixels [as pixelFilter] (filterStrain.html:204)
at Object._setPixelData (ImageServiceLayerMixin.js:41)
at Object.redraw (ImageServiceLayerMixin.js:27)
at setPixelFilter (filterStrain.html:226)
at Object.maskPixels [as pixelFilter] (filterStrain.html:174)
at Object._setPixelData (ImageServiceLayerMixin.js:41)
at Object._requestDataHandler (ImageServiceLayerMixin.js:41)
at init.js:63
at Object._resolve (Raster.js:9)
at Raster.js:7 "TypeError: Cannot read property '0' of undefined
at Object.maskPixels [as pixelFilter] (http://localhost/telstra/filterStrain.html:204:32)
at Object._setPixelData (http://js.arcgis.com/3.20/esri/layers/ImageServiceLayerMixin.js:41:370)
at Object.redraw (http://js.arcgis.com/3.20/esri/layers/ImageServiceLayerMixin.js:27:395)
at setPixelFilter (http://localhost/telstra/filterStrain.html:226:17)
at Object.maskPixels [as pixelFilter] (http://localhost/telstra/filterStrain.html:174:7)
at Object._setPixelData (http://js.arcgis.com/3.20/esri/layers/ImageServiceLayerMixin.js:41:370)
at Object._requestDataHandler (http://js.arcgis.com/3.20/esri/layers/ImageServiceLayerMixin.js:41:276)
at https://js.arcgis.com/3.20/init.js:63:277
at Object._resolve (http://js.arcgis.com/3.20/esri/layers/Raster.js:9:352)
at http://js.arcgis.com/3.20/esri/layers/Raster.js:7:61"

2 Replies
SimonJackson
Occasional Contributor III

I am closer.  

My Mosaic Dataset that I have published actually contains 4 overlapping rasters.

If I publish a Mosaic Dataset with just one of the rasters = works as expected.

Therefore I assume I need to apply a filter to my Image Service parameters to only pull NAME = 'therasternameiwant'

Any clues on how to do this?  Can perform a filter at the WebMap level, but this sample does not use a WebMap.

0 Kudos
SimonJackson
Occasional Contributor III

Ok I added a mosaicrule to filter the image service for the single raster I am interested in. Same error in console.

0 Kudos