Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using gdalwarp to manipulate SRTM tiles near the the dateline (i.e. 180°, aka the antimeridian). SRTM tiles have a very slight (1/2 pixel) overlap with the meridian. You can see this using gdalinfo:

gdalinfo S16W180.hgt
Driver: SRTMHGT/SRTMHGT File Format
Files: S16W180.hgt
Size is 1201, 1201
[...]
Lower Left  (-180.0004167, -16.0004167) (180d 0' 1.50"W, 16d 0' 1.50"S)
Upper Right (-178.9995833, -14.9995833) (178d59'58.50"W, 14d59'58.50"S)
[...]

So the source spans the dateline by a tiny amount.

This causes problems with gdalwarp, which ends up creating huge globe-spanning outputs.

gdalwarp -t_srs "epsg:900913" S16W180.hgt test.tif
gdalinfo test.tif
Driver: GTiff/GeoTIFF
Files: test.tif
Size is 1703, 5
[...]
Lower Left  (-20037508.330,-1806798.473) (180d 0' 0.00"W, 16d 7'13.00"S)
Upper Right (20032839.451,-1689152.120) (179d57'29.01"E, 15d 5'45.84"S)

Note the longitudes span (almost) the entire globe, and also the number of lines is unexpectedly small (5)

Is this a bug in gdalwarp? If not, what are the correct options to pass to gdalwarp to get a sensible output?

share|improve this question
    
dds.cr.usgs.gov/srtm/version2_1/SRTM3/Australia/S16W180.hgt.zip in case you want to experiment. –  gravitystorm Sep 24 '12 at 11:45
    
add the SOURCE_EXTRA Parameter see code.google.com/p/maptiler/issues/detail?id=6 - try gdalwarp -t_srs epsg:900913 -wo SOURCE_EXTRA=120 S16W180.hgt test.tif –  Mapperz Sep 24 '12 at 20:55
    
maybe use -te argument for "target extents", or fix up the extents first using gdal_translate with a_ullr to overwrite the existing, or -projwin to cut out the bit you want within the bounds –  mdsumner Nov 17 '12 at 3:19

1 Answer 1

This is problem in the GDAL library. It appears that GDALSuggestedWarpOutput() is giving weird output for width and height of the output file.

I haven't found a way to work around this yet.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.