Centroid / Point-on-Surface
Generate center points for polygons
What Is a Polygon Centroid?
A centroid is a single representative point for a geometry. For a polygon, it is typically the geometric center of mass β the point where the polygon would balance if it were a physical plate of uniform thickness. For a line, it is the midpoint along the length. For a point cluster, it is the average of all coordinates. Finding the centroid is one of the most common operations in GIS, whether for labeling, thematic mapping, distance calculations, or producing a simplified point representation of a complex polygon layer.
The Centroid / Point-on-Surface tool on gis.tools generates a point for every feature in your layer, entirely in your browser. It supports both the true geometric centroid and the Point-on-Surface variant (sometimes called a "representative point") which guarantees the output point lies inside the polygon β critical for U-shaped, L-shaped, or donut-shaped polygons whose true centroid would fall outside the feature. Whether you need to find a centroid GIS workflow for labeling thousands of countries, building distance matrices, or converting polygons to points for a heatmap, this tool does it in seconds.
Centroids are the simplest form of geometric reduction: they throw away shape information and keep only a single anchor point. This is exactly what you want for labeling, symbol placement, or when feeding point-based analytics.
How Centroid Calculation Works
The classical geometric centroid of a polygon is computed by integrating over the polygon area. For a simple polygon with vertices (xβ, yβ) through (xβ, yβ), the centroid is a weighted average where each triangle formed with the origin contributes its signed area.
Point-on-Surface (Representative Point)
When the true centroid falls outside the polygon (as with a C-shape or a donut), you often want an alternative point that is guaranteed inside. The Point-on-Surface algorithm finds the pole of inaccessibility: the point within the polygon furthest from any boundary. Algorithms like polylabel (used by Mapbox) search a grid of candidates iteratively to find this pole efficiently.
Centroid of a Point Cluster
For a MultiPoint or collection of points, the centroid is the arithmetic mean of coordinates β simple and fast.
Line Centroid
For a line feature, the centroid is the point at the midpoint of total length, not the average vertex location.
Key Parameters and Options
Method
Choose between True Centroid (geometric center of mass) and Point-on-Surface (guaranteed inside). Use Point-on-Surface for labeling or any workflow where the output must lie within the polygon.
Preserve Attributes
Default on β each output point carries the parent polygon's attributes.
Include Area Field
Optionally add a computed area or length column to each centroid record.
Practical Applications
Label Placement
Placing a label at the true centroid of a polygon is the standard starting point for thematic maps. For complex polygons (C-shapes, archipelagos), Point-on-Surface produces better placements inside the visible feature.
Thematic Mapping with Proportional Symbols
Convert polygon layers (countries, regions) to centroids, then use the Graduated Styling tool to draw proportional circles scaled by an attribute. The result is a clean proportional-symbol map without the visual noise of polygon borders.
Origin-Destination Matrices
Before running an origin-destination analysis, most analysts reduce polygon units to centroids so each region has a single representative point for distance calculations. Feed the centroid layer into the Origin-Destination Matrix tool.
Distance to Nearest Feature
Reduce complex polygons to centroids, then compute nearest neighbors with the Nearest Neighbor (kNN) tool to find things like closest hospital to each neighborhood.
Spatial Joins and Point-in-Polygon
Some spatial operations only work efficiently on points. Converting polygons to centroids first lets you use simpler algorithms.
Simplified Visualizations
Zoomed-out maps showing thousands of small polygons often look cluttered. Replacing them with centroid points gives a cleaner overview that still communicates the spatial distribution.
Data Export to Point Formats
Some target systems only accept point data. Converting polygons to centroids is the cleanest way to bridge polygon GIS to point-only tools.
Step-by-Step Workflow in gis.tools
- Open the Centroid / Point-on-Surface tool
- Drag in a polygon layer (GeoJSON, Shapefile, KML)
- Preview the layer in the map view
- Choose True Centroid or Point-on-Surface method
- Optionally enable area or length fields
- Click "Generate Centroids"
- Inspect the output points on the map
- Export as GeoJSON, KML, Shapefile, or CSV with lat/lon
Worked Example
A cartographer is producing a choropleth map of the European Union at the NUTS-2 level and needs labels for each of 281 regions. She loads the NUTS polygon shapefile into the centroid tool, selects Point-on-Surface to avoid labels falling in the Adriatic or outside awkward coastal polygons, and clicks Generate. The output layer has 281 points, each carrying the NUTS code and the regional name. She loads it into the Label Placement Tool for collision-aware label positioning and exports the final map.
Common Pitfalls and Gotchas
- Centroid outside the polygon: For C-shapes, L-shapes, and donuts, the true centroid can fall outside. Use Point-on-Surface instead.
- Multipolygon centroids can produce a single point that doesn't correspond to any actual polygon part. Split with Split Multipart Features first if needed.
- CRS matters for accuracy: centroids computed in WGS84 are approximations; reproject to an equal-area CRS for precise results.
- Degenerate polygons (zero area, self-intersecting, or collapsed) produce meaningless centroids. Fix with Geometry Repair.
- Attribute carry-over: centroid generation typically preserves the polygon's attributes, but make sure the output schema matches your expectations.
- Line centroids at the midpoint may not be what you expected if you assumed it was the spatial center of the bounding box.
- Weighted centroid: sometimes you want a population-weighted or area-weighted centroid, which is a different calculation than the plain geometric centroid.
Tips for Best Results
- Use Point-on-Surface when you need the output guaranteed inside the polygon (labeling, placement)
- Reproject to an equal-area CRS with the EPSG Reprojector & Coordinate Converter for precise centroid locations
- Run Geometry Repair first on messy polygons
- Pair with Label Placement Tool for polished cartographic output
- Add a computed area column so downstream analysis has the magnitude available
Comparison with Other GIS Approaches
QGIS offers Centroids under Vector > Geometry Tools. ArcGIS Pro exposes Feature to Point in Data Management (which computes the centroid) and the Calculate Geometry tool for attribute-based centroid coordinates. PostGIS has ST_Centroid and ST_PointOnSurface. Turf.js has turf.centroid and turf.pointOnFeature. The browser-based gis.tools tool matches the ergonomics of drag-and-drop with the accuracy of Turf.js / polylabel under the hood.
Performance Considerations
Centroid computation is fast β O(n) where n is the total vertex count across all features. Hundreds of thousands of polygons compute in seconds. Point-on-Surface is more expensive because it iteratively searches for the pole of inaccessibility, but still scales to large layers.
Data Privacy and Browser-Based Processing
Your polygon data stays in your browser. The centroids are computed locally and exported locally. This matters for private property, health, or commercial data.
Related GIS Concepts
Centroid, point-on-surface, and representative point are closely related but distinct. Center of mass is synonymous with centroid for uniform-density objects. Pole of inaccessibility is the point furthest from any boundary β used as a tightest-possible interior label anchor. Weighted centroid uses an attribute (e.g., population) to shift the centroid toward denser areas. Bounding box center is the midpoint of the MBR and differs from the true centroid for non-rectangular shapes.
Frequently Asked Questions
How do I compute a polygon centroid?
Drop the layer into the tool, choose method, click Generate. Done.
Why is my centroid outside the polygon?
True centroids of concave or multipart polygons can fall outside. Switch to Point-on-Surface.
Can I get a population-weighted centroid?
Not directly β that requires a raster or per-cell attribute and is outside the scope of this tool.
Does the tool work on lines?
Yes β the centroid of a line is the midpoint along its length.
Related Tools on gis.tools
Related Tools
View All ToolsUnion Tool
Combine geometries from two layers
GeoprocessingGIS Dissolve Tool (Merge by Field)
Merge features based on a common attribute value
GeoprocessingTriangulated Irregular Network (TIN) Generator
Create Delaunay triangulation from points
GeoprocessingLine Intersection Finder
Find all intersection points in line layers
GeoprocessingSnap Points to Line
Snap points to the nearest line or road
GeoprocessingNearest Neighbor (kNN)
Find k nearest features for each input feature
Geoprocessing100% client-side processing - your data stays private and never leaves your device