Mosaic to New raster using python

3890
3
04-08-2012 07:30 AM
ayoubabod
New Contributor
Mosaic to New raster using python
Hello!!
I am trying to mosaic several aster gdem file using python in arcgis 10.
i was found a script to do that for two aster but i have got more than 10 files to merge.
the script i used is :


import arcgisscripting
gp = arcgisscripting.create()

try:
# Set local variables
InRaster = "C:/Users/mycomputer/Desktop/dem/ASTGTM2_N27W001_dem.tif;C:/Users/mycomputer/Desktop/dem/ASTGTM2_N27W002_dem.tif"
OutWorkspace = "C:/Users/mycomputer/Desktop"

# Process: MosaicToNew

gp.MosaicToNewRaster_management(Inraster, OutWorkspace, "all_raster.tif", "#", "16_BIT_UNSIGNED", "#","1", "BLEND", "MATCH")

except:
# Print error message if an error occurs
gp.GetMessages()

Need some help for processing
Tags (2)
0 Kudos
3 Replies
JakeSkinner
Esri Esteemed Contributor
I would recommend using the new mosaic dataset that's available for ArcGIS 10.  Creating the mosaic dataset will be much faster, you will receive much better performance, and you do not need to use a python script to create one.
0 Kudos
RichardThurau
Occasional Contributor
Jake, or others,
Without trying the tool (stuff is running for me right now) I'm curious if your suggested method would work if I wanted to clip the mosaic after creating it? Since, the notes describe the tool as creating a layer that reads existing rasters rather than creating a new dataset.

So, would it work to use this tool to mosaic by image tiles (say 40 tiles), then create clipped images that are from a process grid (say 10 grid polygons)? Or would the clip not work since a comprehensive mosaic does not truly exist?

Thanks for your thoughts

Rich
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Hi Richard,

You can use a mosaict dataset as input to a geoprocessing tool, so you would be able to perform the clip.  Here is some more information:

http://resources.arcgis.com/en/help/main/10.1/index.html#/Using_mosaic_datasets_and_image_services_i...
0 Kudos