Skip to main content
deleted 1 character in body; edited tags
Source Link
Gery
  • 2.1k
  • 1
  • 16
  • 38

When I use:

gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 255 -burn 255 polygon.shp tiff.tiff

I get a new tiff with a white wholehole in it with the shape of the polygon shapefileshp. However, when I use the reverse process:

gdal_rasterize -i -b 1 -b 2 -b 3 -burn 255 -burn 255 -burn 255 polygon.shp tiff.tiff

I get a blank imagetiff. I expect the old tiff shaped by the polygon (ie. raster values inside the polygon), instead.

Any ideas why this happens? is it possible to clip a raster with a shapefile in this way?

When I use:

gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 255 -burn 255 polygon.shp tiff.tiff

I get a new tiff with a white whole with the shape of the polygon shapefile. However, when I use the reverse process:

gdal_rasterize -i -b 1 -b 2 -b 3 -burn 255 -burn 255 -burn 255 polygon.shp tiff.tiff

I get a blank image. I expect the old tiff shaped by the polygon (ie. raster values inside the polygon), instead.

Any ideas why this happens? is it possible to clip a raster with a shapefile in this way?

When I use:

gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 255 -burn 255 polygon.shp tiff.tiff

I get a new tiff with a white hole in it with the shape of the polygon shp. However, when I use the reverse process:

gdal_rasterize -i -b 1 -b 2 -b 3 -burn 255 -burn 255 -burn 255 polygon.shp tiff.tiff

I get a blank tiff. I expect the old tiff shaped by the polygon (ie. raster values inside the polygon), instead.

Any ideas why this happens? is it possible to clip a raster with a shapefile in this way?

Source Link
Gery
  • 2.1k
  • 1
  • 16
  • 38

Reverse gdal_rasterize (-i option) does not work

When I use:

gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 255 -burn 255 polygon.shp tiff.tiff

I get a new tiff with a white whole with the shape of the polygon shapefile. However, when I use the reverse process:

gdal_rasterize -i -b 1 -b 2 -b 3 -burn 255 -burn 255 -burn 255 polygon.shp tiff.tiff

I get a blank image. I expect the old tiff shaped by the polygon (ie. raster values inside the polygon), instead.

Any ideas why this happens? is it possible to clip a raster with a shapefile in this way?