Opened 6 years ago
Last modified 5 years ago
#7247 closed defect
"gdalwarp" incorrect resolution calculation — at Initial Version
Reported by: | justinmilk | Owned by: | warmerdam |
---|---|---|---|
Priority: | high | Milestone: | closed_because_of_github_migration |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | gdalwarp |
Cc: |
Description
Case scenario: GDAL 2.2.x; GeoTIFF, that crosses 180 meridian (example - B2 band of Landsat 8 scene - https://landsat-pds.s3.amazonaws.com/c1/L8/075/066/LC08_L1TP_075066_20180117_20180118_01_RT/LC08_L1TP_075066_20180117_20180118_01_RT_B2.TIF).
When trying to crop it using gdalwarp with the -te option, but not specifying -ts or -tr options, I'm getting an output with the resolution very far from expected, regardless of output extent.
E.g.:
gdalwarp -te_srs "+proj=longlat +datum=WGS84 +no_defs " -te 179.819340820312505 -8.238065294160887 179.916987304687495 -8.141414642148055 -t_srs "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs" -dstalpha -srcnodata 0 B2.TIF B2_new.TIF
Running this command gave me output with size 3x3 pixels and resolution nearing 3600 meters, when original is only 30 meters!
Running the same command, but with -ts option, e.g.
... -ts 256 256 ...
gives the output with resolution ~42 meters, which is much closer to expected.