9

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?

0

2 Answers 2

13

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
2
  • I exported the tif but as a result I'm getting strange "gridded" artefacts on the image. Is there a way to avoid nearest neighbor resampling in gdalwarp? Or could this have another reason? Thank you! Commented Dec 10, 2013 at 9:07
  • 1
    You have to use the -r option: gdal.org/gdalwarp.html Commented Dec 10, 2013 at 9:52
2

the -te flag expects the coordinates to be projected in the -t_srs CRS. EPSG:3857 has as a unit meters, and your inputs are most likely degrees.

to obtain the correct values gdalwarp needs you can project from one coordinate system to antoher using the cs2cs program:

cs2cs +init=epsg:4326 +to +init=epsg:3857

The default order of values are x-y or E-N

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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