I have a customized python raster function, which is pretty simple, setting some given values among the input raster to zero.Here, I used numpy
inputRasterNumpyArray[inputRasterNumpyArray==target_value]=0
The function works well in ArcMap. But when I used this raster function to render an image service, the result is very strange (see below). I can see vector lines when zooming in. Does anyone have any idea why it looks like this?
Solved! Go to Solution.
Just out of curiosity, Kaixi - does the resampling method used by the Image Service match the resampling method used in ArcMap? To check this:
I ask because certain resampling methods can cause display issues - these can be odd-colored outlines around features for example.
Hi Spring,
What kind of input data are you using for this? Are you applying this as a template on a mosaic dataset or are you just using a raster dataset and image service as an input to the function itself? Is there already a template applied to the image service before you publish it or are the raw pixels being transmitted in the image service? Would it be possible for you to send the Python function?
Jamie
Hi Jamie,
Thanks for your help. I published a mosaic dataset as image service. On the service editor, I added a raster function template. The mosaic dataset and the function template were copied to the server together. The python function specified in the template is attached below.
On the client side, I set the mosaic rule and rendering rule:
//render rule
var renderRF = new RasterFunction();
renderRF.functionName = "CustomziedRasterFuncTemplate";
renderRF.functionArguments = {
"ignoredvalues":ignoredPixelValues,
"Raster": "$$"
};
//mosaic rule
var msRule = new MosaicRule();
msRule.method = MosaicRule.METHOD_LOCKRASTER;
msRule.lockRasterIds = [bandIndex]
//image service parameter
var params = new ImageServiceParameters();
params.noData = 0;
params.mosaicRule = msRule;
params.renderingRule=renderRF;
//image service layer
var imageServiceLayer = new ArcGISImageServiceLayer(mosaidImageServiceURL, {
imageServiceParameters: params,
opacity: 1.0
});
Kaixi
Hi Kaixi,
What kind of raster are you applying this function to? I am getting a blank output when i apply this to rasters.
Jamie
Hi Jamie,
Thanks for following-up. I have sent our image service url to your esri email address. Please let me know if anything else is needed. Thanks again!
Kaixi
Just out of curiosity, Kaixi - does the resampling method used by the Image Service match the resampling method used in ArcMap? To check this:
I ask because certain resampling methods can cause display issues - these can be odd-colored outlines around features for example.
Hi Earl, you are right! Jamie helped me figure it out. We changed the data type to Thematic, sampling method to Nearest neighbor, and then rebuilt the pyramid. After those changes, it works well.
Hopefully it could help any others that encounter the same issue.