Exporting a raster dataset to a geodatabase and specifying options
The following code specifies the different options when loading raster datasets to a geodatabase using the geoprocessing tool:
[Java]
static void exportToGeodatabase()throws Exception{
// Use CopyRaster GP tool to load single raster dataset to GDB with options.
// Syntax: CopyRaster <in_raster> <out_rasterdataset> {config_keyword} {background_value} {nodata_value} {NONE | OneBitTo8Bit} {NONE | ColormapToRGB}
// {1_BIT | 2_BIT | 4_BIT | 8_BIT_UNSIGNED | 8_BIT_SIGNED | 16_BIT_UNSIGNED | 16_BIT_SIGNED | 32_BIT_UNSIGNED | 32_BIT_SIGNED | 32_BIT_FLOAT | 64_BIT}
// Set parameters in the same order as the syntax shows, change any parameter to fit your data and loading requirement.
IVariantArray parameters = new VarArray();
// Set in_raster.
parameters.add("c:/tempdata/air-photo-1.tif");
// Set out_rasterdataset.
parameters.add("Database Connections/Connection to qian.sde/RASTER.a_load");
// Set config_keyword to default.
parameters.add("#");
// Set ignore background value to 0.
parameters.add(0);
// Set NoData value to empty.
parameters.add("#");
// Set onebitto8bit to NONE.
parameters.add("NONE");
// Set colormaptoRGB to NONE.
parameters.add("NONE");
// Set output pixel type as default.
parameters.add("#");
// Set geoprocessor for execution.
GeoProcessor geoprocessor = new GeoProcessor();
geoprocessor.execute("CopyRaster", parameters, null);
}
Development licensing | Deployment licensing |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |