Clipping rasters by extent or by a polygon
Cut a raster to a rectangle or to the shape of polygons, set the cells outside to NoData, and crop the grid to the polygon extent.
You will learn
- Clip a raster to a rectangle.
- Mask a raster with polygons.
- Clip several rasters in one run.
Prerequisites
Data for this tutorial
DEM 30 m (synthetic) Download dem.tif
- Format
- GeoTIFF, 1 band, Float32
- Geometry
- Raster, 560 × 480 cells of 30 m
- CRS
- EPSG:32643 (WGS 84 / UTM zone 43N)
- Content
- Elevations 450.01 to 678.95 m; NoData -9999 in the south-west corner
- In Orbis
- Browser panel ▸ Tutorial sample data (synthetic) ▸ DEM 30 m, or Load complete tutorial pack.
Wards (synthetic) Download wards.geojson
- Format
- GeoJSON
- Geometry
- Polygon
- CRS
- EPSG:32643 (WGS 84 / UTM zone 43N)
- Content
- 84 wards (31 peri-urban, 19 rural, 34 urban), 333,497 residents
- In Orbis
- Browser panel ▸ Tutorial sample data (synthetic) ▸ Wards, or Load complete tutorial pack.
Fields used in the tutorials
| Field | Type | Description |
|---|---|---|
ward_id | text | Ward code W01 to W84. |
ward_name | text | Ward name. |
zone | text | urban, peri-urban or rural. |
population | integer | Residents. |
households | integer | Households. |
area_km2 | real | Ellipsoidal area in km². |
density_km2 | real | Persons per km². |
literacy_rate | real | Literate share, per cent. |
Licence: CC0 1.0. All tutorial data is synthetic and generated by Orbis. About the datasets
The task
You want the DEM only for the urban wards, with all other cells set to NoData and the grid cropped to their extent.
Steps
- Add DEM 30 m and Wards. Select the urban wards (Select by attribute:
zone=urban).
In the Toolbox, open Clip raster by mask layer. Choose DEM 30 m (synthetic) as Input raster, Wards (synthetic) as Polygon layer with Selected features only ticked, and tick Crop to the polygon extent. Click Run.

The DEM masked by the urban wards.
- To cut a rectangle instead, open Clip raster by extent and choose the extent from the map view or a layer.
- To clip several rasters, use Batch Processing with Clip rasters by mask layer or Clip rasters by extent.
Expected result
A smaller DEM covering the urban wards, with NoData outside them. The cell size and alignment are unchanged: clipping never resamples.
Common mistakes
- No NoData value for the output. Masked cells need a NoData value; Orbis uses the raster's own, or a suitable default for the data type.
- Worrying about the mask CRS. Mask polygons in another CRS are transformed to the raster CRS automatically. A cell is inside when its centre is inside a polygon.
Troubleshooting
- The result is all NoData. The polygons do not overlap the raster, or Selected features only is ticked with nothing selected. The message in the Processing log says how many cells were inside the mask.
- The raster is opened for display only. Load its pixels first (Dataset tab ▸ Load raster data for processing…).