I have a problem with gdal.ReprojectImage from gdal1.8 Java bindings. When I perform the reprojection, the projected image is totally black. And the origin of the projected image is wrong too. There were no errors popping up at all. The code is the following:
Dataset in_ds = gdal.Open(inPath, gdalconst.GA_ReadOnly);
Dataset out_ds = in_ds.GetDriver().Create(outPath,in_ds.getRasterXSize(), in_ds.getRasterYSize(), in_ds.getRasterCount());
try {
SpatialReference dstRef = new SpatialReference("");
dstRef.ImportFromEPSG(26919);
out_ds.SetProjection(dstRef.ExportToWkt());
out_ds.SetGeoTransform(in_ds.GetGeoTransform());
if (gdal.ReprojectImage(in_ds, out_ds) == gdalconst.CE_Failure)
System.out.println("something is wrong");
} finally {
in_ds.delete();
out_ds.delete();
}
What is going on here?