[GIS] Cropping Geotiff with gdalwarp

demgdalwarpgeotiff-tiff

I downloaded a geotiff from the recently published 25m-DEM of the European Union (see: http://courses.neteler.org/eu-dem-new-digital-surface-model-at-25m/). One tile has about 5GB so I would like to crop it to a smaller extend. I'm trying to use gdalwarp but I can't figure out the correct commands …

Here's my bounding box: N48 W15 S43 E5

This is the command I tried :

gdalwarp -of gtiff -t_srs EPSG:3857 -te 5 43 15 48 input.tif output.tif

This is the error message that gdalwarp returned:

"Creating output file that is 0P x 0L. ERROR 1: Attempt to create 0x0
dataset is illegal,sizes must be larger than zero."

Could anybody give me a hint?

Best Answer

The coordinates of the target extent have to be expressed in the target SRS:

-te xmin ymin xmax ymax:
set georeferenced extents of output file to be created (in target SRS).

Being...

>cs2cs +init=EPSG:4326 +to +init=EPSG:3857
5 43
556597.45       5311971.85 0.00
15 48
1669792.36      6106854.83 0.00

the command should be something like:

gdalwarp -t_srs EPSG:3857 -te 556597.45 5311971.85 1669792.36 6106854.83 input.tif output.tif
Related Question