ST_PointOnSurface
Definition
ST_PointOnSurface takes an ST_Polygon or ST_MultiPolygon and returns an ST_Point guaranteed to lie on its surface.
Syntax
sde.st_pointonsurface (pl1 sde.st_geometry) sde.st_pointonsurface (mpl1 sde.st_geometry)
Return type
ST_Point
Example
The city engineer wants to create a label point for each building's footprint. The building footprints are stored in the buildingfootprints table that was created with the following CREATE TABLE statement:
CREATE TABLE buildings (building_id integer, footprint sde.st_geometry);
INSERT INTO buildings (building_id, footprint) VALUES ( 1, sde.st_polygon ('polygon ((0 0, 0 10, 10 10, 10 0, 0 0))', 0) ); INSERT INTO buildings (building_id, footprint) VALUES ( 2, sde.st_polygon ('polygon ((20 0, 20 10, 30 10, 30 0, 20 0))', 0) );
The ST_PointOnSurface function generates a point that is guaranteed to be on the surface of the building footprints. The ST_PointOnSurface function returns a point that the ST_AsText function converts to text for use by the application.
Oracle
SELECT sde.st_astext (sde.st_pointonsurface (footprint)) Surface_Points FROM BUILDINGS; SURFACE_POINTS POINT (5.00000000 5.00000000) POINT (25.00000000 5.00000000)
PostgreSQL
SELECT sde.st_astext (sde.st_pointonsurface (footprint)) AS Surface_Points FROM buildings; surface_points POINT (5 5) POINT (25 5)
11/18/2013