0

So as the title suggests, I am trying to clip an image (UTM) using the OSM land polygon shapefile (WGS 84).

I use gdal_rasterize to do that and when I do it on a windows machine it works flawlessly regardless of the fact that they don't share the same SRS. When I try to do that on Linux I get an error saying that on-the-fly reprojection is not supported and the image is not clipped. This can be solved by reprojecting either of the files, but I can't reproject the image because it will change its dimensions (and I don't want that) and I also can't reproject the shapefile because there are a lot of errors which lead to an empty file.

I really can't find anything on the internet mentioning this issue.

PS. I use CentOS and Windows 10. GDAL in both machines is the newest version. EDIT: I used the following command to clip the raster with the shapefile:

gdal_rasterize -burn 0 shapefile.shp raster.tif
  • Please add the command that you have used. I do not understand how you can clip with a shapefile by using gdal_rasterize. – user30184 Aug 9 '18 at 14:23
  • I added the command I used. – Nikos Aug 9 '18 at 14:39
  • That's not clipping, its rasterizing or burning. Please edit your question and then check your exact gdal version with gdalinfo --version. The manual gdal.org/gdal_rasterize.html says Note that on the fly reprojection of vector data to the coordinate system of the raster data is only supported since GDAL 2.1.0.. – user30184 Aug 9 '18 at 14:47
  • Sorry, poor choice of words. It should be supported because I run GDAL 2.2.4. That's what makes no sense. – Nikos Aug 9 '18 at 15:56
  • Add the versions you have on both machines to the body of your question. Certainly it makes no sense with version 2.2.4. Add "--debug on" into your command and hope that it gives some more information. Perhaps problem with projection libraries. – user30184 Aug 9 '18 at 16:46

Your Answer

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

Browse other questions tagged or ask your own question.