I can extract a rectangle from a raster using gdalwarp:
gdalwarp -te <x_min> <y_min> <x_max> <y_max> input.tif clipped_output.tif
Is there a way to do this in GDAL using a circle instead of a rectangle?
I can extract a rectangle from a raster using gdalwarp:
gdalwarp -te <x_min> <y_min> <x_max> <y_max> input.tif clipped_output.tif
Is there a way to do this in GDAL using a circle instead of a rectangle?
With gdalwarp, you can do that by using one circular shapefile as 'cut line'. One syntax of command can be:
gdalwarp -overwrite -dstnodata -999 -cutline your_circular_shape.shp original_raster.tif out.tif
In my particular case, I tried out it with raster DEM and shapefile of next image:
My complete command was:
gdalwarp -overwrite -dstnodata -999 -cutline /home/zeito/pyqgis_data/circle.shp /home/zeito/pyqgis_data/utah_demUTM2.tif /home/zeito/out.tif
and it worked; as it can be observed at the next image (where resulting raster was perfectly aligned with original raster).