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!
Take a look at the sections:
in the following help document:
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 )
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.
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'.
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!
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.
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?