[gdal-dev] gdal_translate and -projwin

Frank Warmerdam warmerdam at pobox.com
Wed May 14 12:24:53 EDT 2008


Wendell Turner wrote:
> Are the projwin arguments to gdal_translate signed lat/lng?
> I'm trying to crop a GeoTIFF image, but something is amiss.
> 
> The gdalinfo is shown below, so it seems that this should
> work:
>   gdal_translate ny71n.tif -projwin -77.0 44.0 -69.0 42.0 crop.tif
> however, this results in
>   Input file size is 12069, 4319
>   Computed -srcwin 99674 62813 0 0 from projected window.
>   Computed -srcwin falls outside raster size of 12069x4319.
> 
> I also tried it with the last two parameters as width and
> height (I thought I read that somewhere):
>   gdal_translate ny71n.tif -projwin -77.0 44.0 7.0 -2.0 cropx.tif
> but with approx. the same results.
> 
> What should the parameters be to crop the image using
> lat/lng?

Wendell,

The -projwin arguments need to be in the coordinate system of the
image, which in this case is Mercator meters.  There is no support
with gdal_translate currently to specify the corner coordiantes in
long/lat unless that is the native coordinate system of the image.

> Upper Left  (-8695881.965, 5480014.707) ( 78d 6'59.17"W, 44d17'10.81"N)
> Lower Left  (-8695881.965, 5103214.656) ( 78d 6'59.17"W, 41d48'15.36"N)
> Upper Right (-7642953.088, 5480014.707) ( 68d39'28.14"W, 44d17'10.81"N)
> Lower Right (-7642953.088, 5103214.656) ( 68d39'28.14"W, 41d48'15.36"N)
> Center      (-8169417.527, 5291614.681) ( 73d23'13.65"W, 43d 3'28.61"N)

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    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list