Opened 10 years ago
Last modified 10 years ago
#5437 closed defect
Origin and corner points incorrect for pixel is point GeoJP2 JPEG2000 — at Version 1
Reported by: | degrootc | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.11.0 |
Component: | GDAL_Raster | Version: | 1.10.1 |
Severity: | normal | Keywords: | GeoJP2 JPEG2000 corner point |
Cc: |
Description (last modified by )
When parsing a pixel is point GeoJP2 referenced JPEG2000, GDAL does not correctly adjust for point based referencing. This was discovered when using the Kakadu demo to convert point referenced GeoTIFF data to JPEG2000 files. When using gdalinfo the origin and corner points are off by half of the resolution of a pixel because they have not been adjusted.
The correct adjustment logic for points is shown in the geotiff.ccp source file lines 6553-6557
if( bPixelIsPoint && !bPointGeoIgnore ) { adfGeoTransform[0] -= (adfGeoTransform[1] * 0.5 + adfGeoTransform[2] * 0.5); adfGeoTransform[3] -= (adfGeoTransform[4] * 0.5 + adfGeoTransform[5] * 0.5); }
The gt_kwt_srs.cpp function GTIFWktFromMemBuf is used to parse the GeoTIFF box and calculate the origin for JPEG2000 files. The code listed above is missing from this function, therefore it does not correctly adjust the origin, and by extension the corner points.
I attached a patch file which should resolve this issue.
Change History (3)
by , 10 years ago
Attachment: | gt_wkt_srs.cpp.patch added |
---|
by , 10 years ago
Attachment: | gt_wkt_srs.cpp.diff added |
---|
Diff file showing changes to add pixel is point check
comment:1 by , 10 years ago
Description: | modified (diff) |
---|
Patch file to add pixel is point check