Clipping layers and extracting features within a boundary
Cut lines and polygons to the shape of a boundary with Clip, keep only the features inside an area with Extract by location, and clip several layers at once.
You will learn
- Cut features to a boundary with Clip.
- Keep whole features with Extract by location.
- Clip several layers in one run with Batch Processing.
Prerequisites
Data for this tutorial
Roads (synthetic) Download roads.geojson
- Format
- GeoJSON
- Geometry
- LineString
- CRS
- EPSG:32643 (WGS 84 / UTM zone 43N)
- Content
- 23 roads: 2 primary, 5 secondary, 16 local
- In Orbis
- Browser panel ▸ Tutorial sample data (synthetic) ▸ Roads, or Load complete tutorial pack.
Fields used in the tutorials
| Field | Type | Description |
|---|---|---|
road_id | text | Road identifier. |
name | text | Road name. |
class | text | primary, secondary or local. |
lanes | integer | Number of lanes. |
surface | text | paved or unpaved. |
Study area (synthetic) Download study_area.geojson
- Format
- GeoJSON
- Geometry
- Polygon
- CRS
- EPSG:32643 (WGS 84 / UTM zone 43N)
- Content
- 1 polygon, 105.094 km²
- In Orbis
- Browser panel ▸ Tutorial sample data (synthetic) ▸ Study area, or Load complete tutorial pack.
Fields used in the tutorials
| Field | Type | Description |
|---|---|---|
name | text | District name. |
Facilities (synthetic) Download facilities.geojson
- Format
- GeoJSON
- Geometry
- Point
- CRS
- EPSG:32643 (WGS 84 / UTM zone 43N)
- Content
- 97 points: 3 hospitals, 6 health centres, 26 clinics, 58 schools, 4 colleges
- In Orbis
- Browser panel ▸ Tutorial sample data (synthetic) ▸ Facilities, or Load complete tutorial pack.
Fields used in the tutorials
| Field | Type | Description |
|---|---|---|
facility_id | text | F001 to F097. |
name | text | Facility name. |
category | text | health or education. |
type | text | hospital, health_centre, clinic, school or college. |
ownership | text | public or private. |
capacity | integer | Beds or students. |
opened | integer | Year opened. |
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
Your roads layer extends beyond the district. You want the road network inside the district boundary only, and the list of facilities inside the urban wards.
Steps
Cut lines to a boundary
- Add Roads, Study area and Facilities from the tutorial data.
In the Toolbox, open Clip. Choose Roads (synthetic) as Input layer and Study area (synthetic) as Clip polygons. Click Run.

Roads clipped to the district boundary.
- The new layer Clipped (Roads (synthetic)) keeps the roads' attributes; lines that cross the boundary end at it. Calculate lengths again after clipping (see Calculating area, length and perimeter attributes): stored lengths are not updated automatically.
Keep whole features inside an area
- Add Wards and select the urban wards (Select by attribute:
zone=urban).
- Open Extract by location. Choose Facilities (synthetic) as Input layer, Wards (synthetic) as Comparison layer with Selected features only ticked, and are within as Where the features. Click Run. 73 of the 97 facilities lie in urban wards.
Several layers at once
- To clip many layers to the same boundary, open the Batch Processing workspace, choose Clip vector layers by polygons, tick the layers under Inputs and the boundary as the clip layer, and click Run batch (see Running one tool on many layers).
Expected result
A roads layer that ends at the district boundary, and a layer of the 73 facilities in urban wards.
Common mistakes
- Clip versus Extract by location. Clip cuts geometries; Extract by location keeps or drops whole features and never changes their shape.
- Forgetting Selected features only. Without it the comparison uses every ward, so every facility in the district matches.
Troubleshooting
- The result is empty. The layers may not overlap. Check that both are drawn in the same place; if one is misplaced, its CRS is wrong (see Handling CRS mismatches).
- The clip layer must be polygons. Lines or points cannot be used as a clip boundary.