Select rasters in Mosaic Dataset

1419
6
10-25-2016 11:36 PM
AlinPlesoianu
New Contributor II

Hi all!

I have a question about selecting rasters in a Mosaic Dataset and do processing on those.

I need to calculate a basic image ratio on two rasters in a mosaic dataset (Ex: Raster1/ Raster2) using Python. I know about the GitHub - Esri/raster-functions: A curated set of lightweight but powerful tools for on-the-fly image... , but all the functions apply on the entire Mosaic Dataset, and I did not find any on how to process rasters separately. While I can do the work with the Image Analysis window in ArcGIS Desktop, I did not find any way to automate this in Python/arcpy.

Thanks for any help!

Alin

0 Kudos
6 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Alin,

Take a look at the sections:

Accessing a raster function chain within the mosaic dataset

Editing function chains for multiple rasters at one time

in the following help document:

Editing function chains in a mosaic dataset—Help | ArcGIS for Desktop 

AlinPlesoianu
New Contributor II

Thanks for the answer, Jake!

I know about that section, but my problem is a little bit different. While I can insert raster functions to the separate rasters in the Footprint (say NDVI), I cannot create a general function (at the Mosaic Dataset level) that takes as input same rasters from the mosaic dataset and do an arithmetic operation for example.

Below I attached screenshots of the mosaic, and the Arithmetic Function.

These are the rasters inside the mosaic dataset. They are a separate 1-Band Mosaic Datasets of different years. (Crated with: Creating a mosaic dataset containing raster data from multiple dates—Help | ArcGIS for Desktop )

The rasters in the Mosaic Dataset

On them, I need to apply the difference "Raster_Change_Detection_1_1" / "Raster_Change_Detection_2_2" on-the-fly.

If i go to the Mosaic Functions tab, I cannot choose those two rasters.

Is there a way to do this? Suppose there is a way with raster functions, I can further use arcpy to automatically do this analysis.

Thanks again!

Alin

0 Kudos
JakeSkinner
Esri Esteemed Contributor

One thing you can do is to create two mosaic datasets, one for each Raster_Change_Detection.  You can then apply this Arithmetic function to one of the mosaic datasets.  You will have the option to select the 2nd mosaic dataset for 'Input Raster 2'.

0 Kudos
AlinPlesoianu
New Contributor II

I did this, but it only processes the Mosaic Dataset on which the function is applied:

This is the raster function inserted. The first Mosaic Dataset is a one-band NDVI. I added the second one (Raster_Change_Detection_2_2) by browsing to the location on the GDB.

The processing result is not correct. The function divides the values of the same first Mosaic Dataset, and I only get a value of 1, as below:

Thank you very much!

Alin

0 Kudos
JakeSkinner
Esri Esteemed Contributor

I could not reproduce this.  I have two mosaic datasets (Stadium_2010 & Stadium_2008).  I first ran the Divide tool on the two mosaic datasets to see the result.  I then applied the Arithmetic function to the Stadium_2010 mosaic dataset specifying the Stadium_2008 mosaic dataset as the second raster.  When identifying and comparing the Divide tool result with the Stadium_2010 mosaic dataset, the results are the same.

0 Kudos
AlinPlesoianu
New Contributor II

I did the full workflow again, and it works like that, but the main difficulty was to get it done with arcpy (Edit Raster Function—Data Management toolbox | ArcGIS for Desktop ), as I have many datasets like those. If I export the function chain as a template, it will refer to the same two mosaics, right? How can I make the template apply for any inputs?

Thanks!

Alin

0 Kudos