Opened 14 years ago
Closed 13 years ago
#3066 closed enhancement (fixed)
GdalTools: clipping based on a shapefile mask
Reported by: | brushtyler | Owned by: | brushtyler |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | Version 1.7.0 |
Component: | GDALTools | Version: | |
Keywords: | gdaltools, clip, rasterize, shapefile mask | Cc: | |
Must Fix for Release: | No | Platform: | All |
Platform Version: | Awaiting user input: | no |
Description
It will be useful to add the possibility of clipping based on a shapefile mask. This can be done with the gdal_rasterize and the option burn, eg:
gdal_rasterize -i -burn 255 -b 1 -b 2 -b 3 -l [SHAPELAYER] [SHAPEFILE] [RASTER]
this results ion setting all three bands at 255 for the area outside the shapefile in input.
Thanks Stefano Salvador for the suggestion.
Change History (8)
follow-up: 3 comment:1 by , 13 years ago
comment:3 by , 13 years ago
Replying to lutra:
apparently there is also a way to do it with gdalwarp, and adding at the same time the alpha channel to the output raster, ex:
gdalwarp -of GTiff -r lanczos -dstalpha -cutline shapefile.shp raster_input.tif raster_output.tif
I know the -cutline option since the Hackfest when Tim told me about it. Thanks for reporting it, I forgot to add these information to this ticket.
would be nice too to add this options too in gdalwarp
So,
- improving the clipper (clipping based on a shapefile mask)
- add the -cutline option in the gdalwarp tool too.
comment:4 by , 13 years ago
Component: | Python plugins and bindings → GDALTools |
---|
comment:6 by , 13 years ago
Works for me in Win7 in trunk use cutline in gdalwarp. Why is ticket still open?
comment:7 by , 13 years ago
I want to add it to the Clipper tool, so it can be used to clip whatever kind of layer.
apparently there is also a way to do it with gdalwarp, and adding at the same time the alpha channel to the output raster, ex:
would be nice too to add this options too in gdalwarp