Vector processing

Centroids, convex hulls and merging layers

Create centre points of polygons, outline groups of points with convex hulls, and combine several layers of the same kind into one.

Intermediate2 min read

You will learn

  • Create centroids and points on surface.
  • Build convex hulls per group.
  • Merge layers and keep track of their origin.

Prerequisites

Data for this tutorial

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
FieldTypeDescription
ward_idtextWard code W01 to W84.
ward_nametextWard name.
zonetexturban, peri-urban or rural.
populationintegerResidents.
householdsintegerHouseholds.
area_km2realEllipsoidal area in km².
density_km2realPersons per km².
literacy_raterealLiterate share, per cent.

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
FieldTypeDescription
facility_idtextF001 to F097.
nametextFacility name.
categorytexthealth or education.
typetexthospital, health_centre, clinic, school or college.
ownershiptextpublic or private.
capacityintegerBeds or students.
openedintegerYear opened.

Land use 2019 and 2024 (synthetic) Download landuse_2024.geojson

Format
GeoJSON (also landuse_2019.geojson)
Geometry
Polygon
CRS
EPSG:32643 (WGS 84 / UTM zone 43N)
Content
61 polygons (2024), 50 polygons (2019)
In Orbis
Browser panel ▸ Tutorial sample data (synthetic) ▸ Land use 2024, or Load complete tutorial pack.
Fields used in the tutorials
FieldTypeDescription
lu_idtextPolygon identifier.
classtextbuilt-up, cropland, forest, water or scrub.
codeintegerClass code 1 to 5.
yearinteger2019 or 2024.
area_harealEllipsoidal area in hectares.

Licence: CC0 1.0. All tutorial data is synthetic and generated by Orbis. About the datasets

The task

You need one point per ward for labelling, an outline around each type of facility, and the land-use layers of 2019 and 2024 in a single layer.

Steps

  1. Add Wards, Facilities, Land use 2019 and Land use 2024 from the tutorial data.
  1. In the Toolbox, open Centroids and run it on the wards. You get 84 points with the ward attributes, at the area-weighted centre of each ward. For odd shapes the centroid can lie outside the polygon; Point on surface always gives a point inside.
  1. Open Convex hull. Choose Facilities (synthetic), One hull per field value as Mode and type as Group field. Run it. Each of the five facility types gets the smallest convex polygon around its points, with a count field (3 hospitals, 6 health centres, 26 clinics, 58 schools, 4 colleges).

    Convex hulls around the facilities of each type, drawn over the facility points
    One convex hull per facility type.
  1. Open Merge vector layers, tick both land-use layers under Layers to merge and run it. The merged layer has the features of both, with a layer field that names the source layer, so you can still tell the years apart.

Expected result

A centroid layer of 84 points, five convex hulls and one land-use layer with the 50 polygons of 2019 and the 61 of 2024.

Common mistakes

  • Merging different geometry types. Merging points with polygons creates a mixed layer that many formats (such as shapefiles) cannot store in one file.
  • Using centroids for area statistics. A centroid summarises a polygon by one point; use a spatial join with the polygons themselves when containment matters.

Troubleshooting

  • Fields are missing after a merge. Fields that exist in only one layer are kept and are NULL for the features of the other.