rendering image service using raster function create rainbows?

1517
6
Jump to solution
01-16-2018 10:56 AM
springzhang
New Contributor II

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?  

0 Kudos
1 Solution

Accepted Solutions
EarlMedina
Esri Regular Contributor

Just out of curiosity, Kaixi - does the resampling method used by the Image Service match the resampling method used in ArcMap? To check this:

  • Go the Services Directory to view the service details. There you'll find a property "Default Resampling Method"
  • In ArcMap, check the properties of the Layer and switch to the Display tab.

I ask because certain resampling methods can cause display issues - these can be odd-colored outlines around features for example.

View solution in original post

0 Kudos
6 Replies
JamieDrisdelle
New Contributor III

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

springzhang
New Contributor II

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

0 Kudos
JamieDrisdelle
New Contributor III

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

0 Kudos
springzhang
New Contributor II

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

0 Kudos
EarlMedina
Esri Regular Contributor

Just out of curiosity, Kaixi - does the resampling method used by the Image Service match the resampling method used in ArcMap? To check this:

  • Go the Services Directory to view the service details. There you'll find a property "Default Resampling Method"
  • In ArcMap, check the properties of the Layer and switch to the Display tab.

I ask because certain resampling methods can cause display issues - these can be odd-colored outlines around features for example.

0 Kudos
springzhang
New Contributor II

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. 

0 Kudos