[gdal-dev] Problem with gdal1.8 Java bindings gdal.ReprojectImage, produces no data

William Kang weliam.cloud at gmail.com
Sun May 8 01:32:58 EDT 2011


Hi folks,
I am new to this mailing list. Thanks all for your great job on GDAL/OGR.

I have a problem with the 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 error popping up at all. The code is as 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();
		}

Does anybody know what's going on here? Thanks a lot.


William


More information about the gdal-dev mailing list