How to maintain mosaic rules when running raster function with multiple raster inputs?

698
1
04-27-2018 06:46 AM
LukeJohnson3
New Contributor

Hey there,

I'm running some raster analysis tools using ArcGIS API for python version 1.4.0, and ArcGIS Portal version 1.5.1 with image server extension. I'm trying to use some math raster functions (with 2 or more input rasters), and running into some problems maintaining the mosaic rule for certain rasters. For example, I've successfully created ImageryLayer objects using the ArcGIS API for python, and added a mosaic rule to query a certain raster within the service with the method ImageryLayer.mosaic_rule. This works great, and the mosaic rule is successfully applied when running a raster function on one raster (ex clip, remap, etc).

However, problems arise when running a raster function on two or more image service rasters at a time. So far I have tested this with both the raster_calculator, and the boolean_and function. These functions both successfully run, but when I add the result to a map, I noticed that only the mosaic rule of the first raster in the list of raster inputs is having its mosaic rule applied. I did some digging, and looked at the underlying HTTP call, and it turns out the exportImage REST endpoint of the first image service in the list of inputs rasters is being called, with its mosaicRule parameter filled out properly. In the renderingRule parameter, there is no indication of the mosaic rule of the remaining rasters for the function applied, meaning the full image service is being used in the function for rasters 2 ,3,...n, in the input list, without respecting the mosaic rules that have been previously defined. When I switch the order of input rasters (and modify the expression according), I get a different result.

What I'm trying to do is find the intersection of multiple rasters in different image services where each meet a certain set of criteria. Each image service could contain 10's of thousands of images (eg temperature, humidity), and thus creating a separate image service for each raster is not an option. Am I missing a step when trying to apply the raster function to multiple rasters, or is there better methodology I should follow to create the result I'm looking for? I should mention that I've tried this same methodology in ArcGIS Pro 2.1.2, and runs perfect when executed locally AND executed when submitting to Portal. The definition query (mosaic rule) is respected in this case. 

Any help/advice is greatly appreciated! Thanks in advance.

Luke

1 Reply
EarlMedina
Esri Regular Contributor

For the benefit of others who may run into this issue this is due to a software defect which was logged as:

BUG-000113957: The raster_calculator function only recognizes the first raster in an array of rasters, thereby not honoring the extent_type parameter.

Please be aware that there are plans to address this issue (Luke, you noted 1.4.0 but the issue is seen at 1.4.1. I believe I indirectly assisted you with this issue!)

0 Kudos