Name

ST_PointOnSurface — Returns a Point guaranteed to lie on the geometry

Synopsis

geometry ST_PointOnSurface(bytea Geometry);

Alias

PointOnSurface

Description

Returns a Point guaranteed to lie on the geometry

[Note]

OGC originally defined this function for Surfaces as MultiSurfaces, Jaspa extends it to any Geometry

[Note]

3D and M, are not supported for surface geometries.

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
2.1.9.1 , 2.1.11.17.2.14.1 , 7.2.18.17.2.12.2 , 7.2.19.28.1.5 , 9.5.6

Examples

--MultiPoint
SELECT ST_AsText(ST_PointOnSurface(ga)) from 
(SELECT ST_GeomFromText('MULTIPOINT (-10 30, 0 30, -10 20, -2 24, -7 27, -6 21)') as ga) as foo;
--Result
POINT (-7 27)

--LineString
SELECT ST_AsText(ST_PointOnSurface(ga)) from 
(SELECT ST_GeomFromText('LINESTRING (0 0 0 -2, 10 10 20 -5, 10 5 10 -8, 15 10 20 -4)') as ga) as foo;
--Result
POINT (10 5 10 -8)

--Polygon
SELECT ST_AsText(ST_PointOnSurface(ga)) from 
(SELECT ST_GeomFromText('POLYGON ((10 30 2, 0 10 4, 30 20 6, 30 30 8, 20 40 8, 10 30 2))') as ga) as foo;
--Result
POINT (18.75 25)
LineString
Polygon

Related functions

ST_PointOnBoundary