Whether it's needed for dataset generalization, labelling, or using in a point-only calculation, the centroid calculation right in the DB might come in handy. This is the job of the ST_Centroid function. The usage is simple, as the only required parameter is the input geometry, which can be of any type (an ST_Centroid of a point will return the original point). However, the most common (and legitimate) use case for centroid calculation is for polygons. Let's compute centroids for all water bodies in our database:
SELECT ogc_fid, name, ST_Centroid(wkb_geometry) FROM multipolygons WHERE "natural" = 'water';

But for some features, such as an oxbow lake, the centroid isn't a correct representation because it can be located outside of the polygon's interior. Also, for lines, the centroid can be computed, but the resultant point will rarely be located precisely on a line.
For these cases, another function, ST_PointOnSurface, was designed. The point-on-surface is guaranteed to be contained within the polygon's interior (or along a line, in case a LineString is supplied):
SELECT ogc_fid, name, ST_PointOnSurface(wkb_geometry) FROM multipolygons WHERE "natural" = 'water';
