# ST_PointOnSurface

Release 9.3
Note: This topic was updated for 9.3.1.

## Definition

ST_PointOnSurface takes an ST_Polygon or ST_MultiPolygon and returns an ST_Point guaranteed to lie on its surface.

## Syntax

Oracle

``````sde.st_pointonsurface (pl1 sde.st_geometry)
sde.st_pointonsurface (mpl1 sde.st_geometry)
``````

PostgreSQL

``````st_pointonsurface (pl1 st_geometry)
st_pointonsurface (mpl1 st_geometry)
``````

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.

Oracle

``````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)
);``````

PostgreSQL

``````CREATE TABLE buildings (building_id integer,
footprint st_geometry);``````

``````INSERT INTO buildings (building_id, footprint) VALUES (
1,
st_polygon ('polygon ((0 0, 0 10, 10 10, 10 0, 0 0))', 0)
);
INSERT INTO buildings (building_id, footprint) VALUES (
2,
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 st_astext (st_pointonsurface (footprint)) AS Surface_Points
FROM buildings;
surface_points
POINT  (5 5)
POINT  (25 5)``````