ST_PointOnSurface

Definition

ST_PointOnSurface akzeptiert ein ST_Polygon- oder ST_MultiPolygon-Objekt und gibt ein ST_Point-Objekt zurück, das sicher auf der Oberfläche der angegebenen Geometrie liegt.

Syntax

Oracle und PostgreSQL

sde.st_pointonsurface (polygon1 sde.st_geometry)
sde.st_pointonsurface (multipolygon1 sde.st_geometry)

SQLite

st_pointonsurface (polygon1 geometryblob)
st_pointonsurface (multipolygon1 geometryblob)

Rückgabetyp

ST_Point

Beispiel

Ein Ingenieur des Bauamts möchte einen Label-Punkt für den Grundriss jedes historischen Gebäudes erstellen. Die Grundrisse historischer Gebäude werden in der Tabelle "hbuildings" gespeichert, die mit der folgenden CREATE TABLE-Anweisung erstellt wurde:

Die Funktion ST_PointOnSurface generiert einen Punkt, der sicher auf der Fläche des angegebenen Gebäudegrundrisses liegt. Die Funktion ST_PointOnSurface gibt einen Punkt zurück, der von der Funktion ST_AsText in Text konvertiert wird, der von der Anwendung verwendet wird.

Oracle

CREATE TABLE hbuildings (
 hbld_id integer,
 hbld_name varchar(40)
 footprint sde.st_geometry
);
INSERT INTO hbuildings (hbld_id, hbld_name, footprint) VALUES (
 1,
 'First National Bank',
 sde.st_polygon ('polygon ((0 0, 0 .010, .010 .010, .010 0, 0 0))', 4326)
);

INSERT INTO hbuildings (hbld_id, hbld_name, footprint) VALUES (
 2,
 'Courthouse',
 sde.st_polygon ('polygon ((.020 0, .020 .010, .030 .010, .030 0, .020 0))', 4326)
);
SELECT sde.st_astext (sde.st_pointonsurface (footprint)) Historic_Site
 FROM HBUILDINGS;

HISTORIC_SITE

POINT  (0.00500000 0.00500000)
POINT  (0.02500000 0.00500000)

PostgreSQL

CREATE TABLE hbuildings (
 hbld_id serial,
 hbld_name varchar(40)
 footprint sde.st_geometry
);
INSERT INTO hbuildings (hbld_name, footprint) VALUES (
 'First National Bank',
 sde.st_polygon ('polygon ((0 0, 0 .010, .010 .010, .010 0, 0 0))', 4326)
);

INSERT INTO hbuildings (hbld_name, footprint) VALUES (
 'Courthouse',
 sde.st_polygon ('polygon ((.020 0, .020 .010, .030 .010, .030 0, .020 0))', 4326)
);
SELECT sde.st_astext (sde.st_pointonsurface (footprint)) 
 AS "Historic Site"
 FROM hbuildings;

Historic Site

POINT  (0.00500000 0.00500000)
POINT  (0.02500000 0.00500000)

SQLite

CREATE TABLE hbuildings (
 hbld_id integer primary key autoincrement not null,
 hbld_name text(40)
);

SELECT AddGeometryColumn(
 NULL,
 'hbuildings',
 'footprint',
 4326,
 'polygon',
 'xy',
 'null'
);
INSERT INTO hbuildings (hbld_name, footprint) VALUES (
 'First National Bank',
 st_polygon ('polygon ((0 0, 0 .010, .010 .010, .010 0, 0 0))', 4326)
);

INSERT INTO hbuildings (hbld_name, footprint) VALUES (
 'Courthouse',
 st_polygon ('polygon ((.020 0, .020 .010, .030 .010, .030 0, .020 0))', 4326)
);
SELECT st_astext (st_pointonsurface (footprint)) 
 AS "Historic Site"
 FROM hbuildings;

Historic Site

POINT  (0.00500000 0.00500000)
POINT  (0.02500000 0.00500000)

Verwandte Themen

5/10/2014