mosaic to new raster - how to mosaic rasters in different directories

569
3
06-11-2014 04:18 PM
DennisJongsomjit
New Contributor II
Hi all,
Can anyone help with figuring out how to list multiple rasters that are each saved in different folders for using within the mosaic to new raster tool?  Can't figure this out after much searching and testing.  I've tried putting the input rasters in brackets, in quotes,without quotes... I just keep getting an invalid syntax warning Failed to execute (MosaicToNewRaster)..  The example in the help file only lists one raster as the input raster and so I nominate it for worst help file - why would you want to mosaic a single raster?!?

Thanks!

-DJ

----------
import arcgisscripting

gp = arcgisscripting.create(9.3)
workspace = r"Z:\Climate"
gp.workspace = workspace

outRaster = "mosaic12"
rastOne=r"V:\Project\rast1"
rastTwo=r"C:\Project\subfolder\rast2"
outRaster = "class7030"
gp.MosaicToNewRaster_management([rastOne;rastTwo], workspace, outRaster, "", "8_BIT_UNSIGNED", "2", "1", "FIRST", "FIRST")

-----------


If I use:
gp.MosaicToNewRaster_management("rastOne;rastTwo", workspace, outRaster, "", "8_BIT_UNSIGNED", "2", "1", "FIRST", "FIRST")

I get:
ERROR 000732: Input Rasters: Dataset rastOne;rastTwo does not exist or is not supported
Tags (2)
0 Kudos
3 Replies
Zeke
by
Regular Contributor III
I don't know if 9.3 supports mosaic to new raster, but the help for 10.2 uses two rasters as input. Anyway, since these rasters are coming from and going to a folder rather than a .gdb, they need the file extensions.
0 Kudos
DennisJongsomjit
New Contributor II
I don't know if 9.3 supports mosaic to new raster, but the help for 10.2 uses two rasters as input. Anyway, since these rasters are coming from and going to a folder rather than a .gdb, they need the file extensions.


Thanks for the reply.  9.3 does have a mosaic to new raster tool but I wonder if the 10.2 version is all new.  So is it not possible then to save to a folder if you want to end up with ESRI grids?  The help says no extension for ESRI grids but also no extension if it's going into a .gdb....

I'll try out your suggestions and report back.
0 Kudos
Zeke
by
Regular Contributor III
DennisJongsomjit;395845 wrote:
Thanks for the reply.  9.3 does have a mosaic to new raster tool but I wonder if the 10.2 version is all new.  So is it not possible then to save to a folder if you want to end up with ESRI grids?  The help says no extension for ESRI grids but also no extension if it's going into a .gdb..../QUOTE]


ESRI grids are always in a geodatabase. Regular folders need the file extension. As for whether the tool will work with 9.3, I don't know but arcpy was introduced at 10.0. Never used the older gp method, so can't say what works and what doesn't.
0 Kudos