Name

ST_PointOnSurface — Berechnet einen Punkt, der garantiert in einem Polygon oder auf einer Geometrie liegt.

Übersicht

geometry ST_PointOnSurface(geometry g1);

Beschreibung

Gibt einen POINT zurück, der garantiert im Inneren einer Fläche liegt (POLYGON, MULTIPOLYGON und CURVEPOLYGON). In PostGIS funktioniert diese Funktion auch für Linien- und Punktgeometrien.

Diese Methode implementiert die OGC Simple Features Implementation Specification for SQL 1.1. s3.2.14.2 // s3.2.18.2

Diese Methode setzt die SQL/MM-Spezifikation um. SQL-MM 3: 8.1.5, 9.5.6. Die Spezifikationen definieren ST_PointOnSurface nur für Oberflächengeometrien. PostGIS erweitert die Funktion, um alle gängigen Geometrietypen zu unterstützen. Andere Datenbanken (Oracle, DB2, ArcSDE) scheinen diese Funktion nur für Flächen zu unterstützen. SQL Server 2008 unterstützt alle gängigen Geometrietypen.

Diese Funktion unterstützt 3d und lässt den Z-Index nicht fallen.

Beispiele

Point on surface of a MultiPoint.

Code
SELECT ST_PointOnSurface(
  'MULTIPOINT (8 24,10 92,12 154,17 68,28 10,29 52,29 84,55 50,56 24,131 14,160 180,189 180)');
Ausgabe von Rastern
POINT(55 50)
Figure
Geometry figure for st-pointonsurface-multipoint

Point on surface of a LineString.

Code
SELECT ST_PointOnSurface(
  'LINESTRING (190 160,10 190,40 90,20 70,10 10,30 40,30 10,110 40,70 10,110 10,140 40,140 10,160 30,180 10)');
Ausgabe von Rastern
POINT(40 90)
Figure
Geometry figure for visual-st-pointonsurface-02

Point on surface of a Polygon.

Code
SELECT ST_PointOnSurface(
  'POLYGON ((190 190,10 190,10 10,190 10,190 20,160 30,60 30,60 130,190 140,190 190))');
Ausgabe von Rastern
POINT(35 80)
Figure
Geometry figure for visual-st-pointonsurface-03

Point on surface of the highest-dimension components of a GeometryCollection.

Code
SELECT ST_PointOnSurface(
  'GEOMETRYCOLLECTION (POLYGON ((190 170,180 100,80 140,80 160,130 160,110 180,110 190,180 180,190 170)),
    LINESTRING (80 120,120 20,140 70,150 30,180 50,190 10),
    MULTIPOINT (19 150,22 49,30 13,32 101,45 35,67 88,75 16))');
Ausgabe von Rastern
POINT(133.571 150)
Figure
Geometry figure for visual-st-pointonsurface-04
Code
SELECT ST_PointOnSurface('LINESTRING(0 5 1,0 0 1,0 10 2)');
Ausgabe von Rastern
st_asewkt
--------------
 POINT(0 0 1)
(1 row)
Figure
Geometry figure for visual-st-pointonsurface-05

Beispiel: Das Ergebnis von ST_PointOnSurface liegt garantiert innerhalb von Polygonen, während der von ST_Centroid berechnete Punkt außerhalb liegen kann.

Code
SELECT ST_PointOnSurface(geom) AS pt_on_surf, ST_Centroid(geom) AS centroid
    FROM (SELECT 'POLYGON ((130 120,120 190,30 140,50 20,190 20,
                      170 100,90 60,90 130,130 120))'::geometry AS geom) AS t;
Ausgabe von Rastern
pt_on_surf    |                  centroid
-----------------+---------------------------------------------
 POINT(62.5 110) | POINT(100.18264840182648 85.11415525114155)
Figure
Geometry figure for visual-st-pointonsurface-06