Skip to content

ST_PointOnSurface

Returns a point guaranteed to lie on the surface of a geometry or geography.

Usage

geography ST_PointOnSurface(geog: geography)

Arguments

  • geog (geography): Input geography

Description

Unlike ST_Centroid which does not necessarily intersect a geometry or geography, ST_PointOnSurface makes an attempt to find an interior point close to the middle (using deterministic heuristics).

Examples

SELECT ST_PointOnSurface(
    ST_GeogFromWKT('POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0), (1 1, 1 3, 3 3, 3 1, 1 1))')
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_pointonsurface(st_geogfromwkt(Utf8("POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0), ( │
│                        1 1, 1 3, 3 3, 3 1, 1 1))")))…                        │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POINT(3.419552724260362 0.9040500541398949)                                  │
└──────────────────────────────────────────────────────────────────────────────┘