#5980 closed defect (fixed)
GDALWarp Geolocation Failed
Reported by: | liminlu0314 | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.11.3 |
Component: | Algorithms | Version: | 1.11.2 |
Severity: | normal | Keywords: | Gdalwarp, geoloc |
Cc: |
Description
GDAL will fail when performing Geolocation warp to the data in the attachment. The error occurs in the file "alg\gdaltransformer.cpp", line 703~706, when GDALSuggestedWarpOut2 function is calculating the size of output image.
The original code:
if( pabSuccess[0] && pabSuccess[nSamplePoints - 1] ) { dfDeltaX = padfX[nSamplePoints-1] - padfX[0]; dfDeltaY = padfY[nSamplePoints-1] - padfY[0]; }
when the coordinates of the first point(0) and the last point(nSamplePoints-1) are equal, dfDeltaX and dfDeltaY will both be zero, leading to the calculation error of output image size. This can be solved by the following codes:
if( pabSuccess[0] && pabSuccess[nSamplePoints - 1] ) { dfDeltaX = padfX[nSamplePoints-1] - padfX[0]; dfDeltaY = padfY[nSamplePoints-1] - padfY[0]; if(dfDeltaX == 0 || dfDeltaY == 0) { dfDeltaX = dfMaxXOut - dfMinXOut; dfDeltaY = dfMaxYOut - dfMinYOut; } }
Accessories for the test data, using gdalwarp tools for testing:
gdalwarp.exe -geoloc H2A_SM2B20130716_09026.vrt H2A_SM2B20130716_09026.tif
H2A_SM2B20130716_09026.h5 is original data;
H2A_SM2B20130716_09026.vrt is virtual data to construct containing Geolocation metadata;
H2A_SM2B20130716_09026.tif is correct warp data.
Change History (4)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Milestone: | → 1.11.3 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Due to the limited attachment size, the test data have been uploaded to Baidu Cloud, which can be downloaded here:
http://pan.baidu.com/s/1sjyWwY5
Thanks