Performing geodata transformation on a raster
A geodata transformation is a mathematical model that performs geometric transformation on a raster. The geodata transformation consists of many concrete classes such as, PolynomialXform, RPCXform, AdjustXform, and so on.
To perform geodata transformation on a raster, you need to set it on the raster first, then set the output extent and cell size. See the following:
static void setGeodataXformAndSaveAs(IRaster2 raster, IGeodataXform xform)throws
Exception{
//Get the original extent and cell size of the raster.
IRasterProps rasterProp = (IRasterProps)raster;
IEnvelope extent = rasterProp.getExtent();
IPnt cellSize = rasterProp.meanCellSize();
double[] xCell = {
cellSize.getX()
};
double[] yCell = {
cellSize.getY()
};
//Set the xform on the raster.
raster.setGeodataXform(xform);
//Transform the cell size first, then the extent; the sequence matters.
xform.transformCellsize(esriTransformDirection.esriTransformForward, xCell,
yCell, extent);
xform.transformExtent(esriTransformDirection.esriTransformForward, extent);
//Put the transformed extent and cell size on the raster and save as.
rasterProp.setExtent(extent);
rasterProp.setWidth((int)(extent.getWidth() / xCell[0]));
rasterProp.setHeight((int)(extent.getHeight() / yCell[0]));
//Save the raster.
ISaveAs saveAs = new ISaveAsProxy(raster);
saveAs.saveAs("c:/temp/image1.img", null, "IMAGINE Image");
}
Development licensing | Deployment licensing |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |