How to mosaic raster datasets to a raster dataset in a geodatabase


Mosaicking raster datasets to a raster dataset in a geodatabase

This article shows the best practice to mosaic multiple raster datasets into a raster dataset stored in ArcSDE or a file geodatabase using the geoprocessing mosaic tool class. You can change any options set in the following code example according to your requirements:
[Java]
//    Use GP Mosaic tool clas to mosaic a list of input rasters to the target GDB(file GDB or ArcSDE) raster
Mosaic mosaic = new Mosaic();
mosaic.setInputs("c:/tempdata/air/air1.tif;c:/tempdata/air/air2.img");
mosaic.setTarget("C:/tempdata/new.gdb/AIRPHOTOS");

//    Optional parameters, should be set according to data properties and mosaicking requirements
//    Modify or remove any statement as necessary

//    Set background value to be ignored
mosaic.setBackgroundValue(0);

//    Set Nodata value
mosaic.setNodataValue(0);

//    Set Mosaic Mode
mosaic.setMosaicType("LAST");

//    Set Mosaic Colormap mode
mosaic.setColormap("MATCH");

//    Set Mosaic tolerance
mosaic.setMosaickingTolerance(0.45);
GeoProcessor geoprocessor = new GeoProcessor();

//    Execute the tool to mosaic the input raster dataset to the target raster 
Object outRaster = geoprocessor.execute(mosaic, null);






Development licensingDeployment licensing
ArcGIS for Desktop BasicArcGIS for Desktop Basic
ArcGIS for Desktop StandardArcGIS for Desktop Standard
ArcGIS for Desktop AdvancedArcGIS for Desktop Advanced
Engine Developer KitEngine