[Gdal-dev] Computing srcwin fails

Frank Warmerdam warmerdam at pobox.com
Tue Oct 11 13:43:36 EDT 2005


On 10/10/05, Morten Nielsen <mn at blominfo.dk> wrote:
>
>
>
> I'm trying to create a bunch of image tiles from a VRT file using
> gdal_translate.
>
> This works great for most of the 517 tiles, but 7 of them fails with the
> following error message:
>
> gdal_translate -projwin 635149 1499749 642149 1492749 -a_srs "+proj=
>
> utm +zone=48 +datum=WGS84" mosaic.vrt sheets\6236-II_004.tif
>
> Input file size is 150000, 210000
>
> Computed -srcwin -1550 36251 7000 7000 from projected window.
>
> Computed -srcwin falls outside raster size of 150000x210000.
...
> Could this be a bug in gdal_translate or the VRT driver? The 7 tiles are the
> only ones whose upper side or left side falls outside the window.

Morten,

The problem is that gdal_translate does not support "srcwin"
regions that fall off the source raster, even partially.  You might
be better off using gdalwarp for at least these tiles.  Gdalwarp
is "savvy" about sampling from an input that only partly
intersects the desired tile area.

Of course, the arguments will be significantly different.  You will
need to specify your target region (the projected window) via
the -te switch, and the resolution or tile size with -tr or -ts
respectively.

eg.

gdalwarp -te 635149 1499749 642149 1492749 -ts 7000 7000 \
   -s_srs "+proj=utm +zone=48 +datum=WGS84" \
     mosaic.vrt sheets\6236-II_004.tif

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list