2

I tryed to clip a Raster file using an ESRI shapefile using gdalwarp command, but i always get an empty output file or a wrong clip with wrong location. this the command bellow:

gdalwarp -dstnodata -999 -q -s_srs '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +no_defs' -t_srs 'EPSG:3857' -cutline mask.shp -crop_to_cutline -of GTiff inputRaster.tif outputRaster.tif
  • 1
    is your shp also in mercator ? – radouxju Feb 10 '14 at 18:23
  • yes it is in pseudo mercator – fkili mohamed Feb 10 '14 at 18:32
2

It is a bit tricky to crop and reproject the tif in one step. Better try the clipping first, then the reprojection.

I had some problems with clipping in EPSG:3857 too. This might be due to the special treatment of the Google Mercator CRS. If possible, convert tif and shapefile to another (and the same!) CRS, like UTM of your part of the world, or EPSG:4326.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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