AnsweredAssumed Answered

Image Service Raster Function Arithmetic substraction between multiple rasters

Question asked by bharanigurminder on May 18, 2020

Hi Team,

 

We have a mosaic dataset which where for a single date there are multiple raster dataset

The objective is to substract Raster1 with Raster2

Where Raster1 and Raster2 are a collection of raster datasets for dates for example 01/01/2020 and 01/02/2020 respectively 

 

The objectID's for Raster1 are 79, 80 

The objectID's for Raster2 are 81,82,83,84

 

When I attempt on using mulitple raster objecID's in rasterFunctionArguments it returns an image where all pixel values are 0

 

Following is the JSON of rendering rule    

 

{
"rasterFunction": "Stretch",
"rasterFunctionArguments": {
"StretchType": 6,
"MinPercent": 2,
"MaxPercent": 2,
"Gamma": [
1.25,
1.25,
1.25
],
"DRA": true,
"Min": 0,
"Max": 255,
"Raster": {
"rasterFunction": "Arithmetic",
"rasterFunctionArguments": {
"Raster": {
"rasterFunction": "Grayscale",
"rasterFunctionArguments": {
"Raster": ["$79","$80"]
}
},
"Raster2": {
"rasterFunction": "Grayscale",
"rasterFunctionArguments": {
"Raster": ["$81","$82","$83","$84"]
}
},
"Operation": "2",
"ExtentType": 0,
"CellsizeType": 1
},
"outputPixelType": "F32"
}
},
"outputPixelType": "U8"
}

 

 

When I use just single objectID in the rasterFunctionArguments then the raster functions work fine, however this gets the results of only overlapping objectID's if the objectID's do not overlap between Raster and Raster2 it returns nothing.

 

Following JSON substraction between two raster is successful only when two objectID's intersect:

 

{
"rasterFunction": "Stretch",
"rasterFunctionArguments": {
"StretchType": 6,
"MinPercent": 2,
"MaxPercent": 2,
"Gamma": [
1.25,
1.25,
1.25
],
"DRA": true,
"Min": 0,
"Max": 255,
"Raster": {
"rasterFunction": "Arithmetic",
"rasterFunctionArguments": {
"Raster": {
"rasterFunction": "Grayscale",
"rasterFunctionArguments": {
"Raster": "$79"
}
},
"Raster2": {
"rasterFunction": "Grayscale",
"rasterFunctionArguments": {
"Raster": "$82"
}
},
"Operation": "2",
"ExtentType": 0,
"CellsizeType": 1
},
"outputPixelType": "F32"
}
},
"outputPixelType": "U8"
}

 

The project demands for rendering rule to be set in such a way that it could substract using arithmetic raster function where Raster and Raster2 has multiple objectID's 

 

Is there any way to achieve this?

 

Any suggestions would be appreciated.

Outcomes