ST_Aggr_Intersection

HinweisHinweis:

Nur Oracle und SQLite

Definition

Die Funktion "ST_Aggr_Intersection" gibt eine einzelne Geometrie zurück, die eine Vereinigungsmenge der Schnittmengen aller Eingabegeometrien ist.

Syntax

Oracle

sde.st_aggr_intersection (geometry1 sde.st_geometry)

SQLite

st_aggr_intersection (geometry1 geometryblob)

Rückgabetyp

Oracle

ST_Geometry

SQLite

Geometryblob

Beispiel

In diesem Beispiel sucht ein Biologe die Schnittmenge dreier Lebensräume von Wildtieren.

Oracle

Erstellen Sie zunächst die Tabelle, in der die Lebensräume gespeichert sind.

CREATE TABLE habitats (
 id integer not null,
 shape sde.st_geometry
);

Fügen Sie anschließend der Tabelle die drei Polygone hinzu.

INSERT INTO habitats (id, shape) VALUES (
 1,
 sde.st_polygon ('polygon ((5 5, 12 5, 12 10, 5 10, 5 5))', 4326)
);

INSERT INTO habitats (id, shape) VALUES (
 2,
 sde.st_polygon ('polygon ((10 8, 14 8, 14 15, 10 15, 10 8))', 4326)
);

INSERT INTO habitats (id, shape) VALUES (
 3,
 sde.st_polygon ('polygon ((6 8, 20 8, 20 20, 6 20, 6 8))', 4326)
);

Wählen Sie schließlich die Schnittmenge für die Lebensräume aus.

SELECT sde.st_astext(sde.st_aggr_intersection(shape)) AGGR_SHAPES 
 FROM habitats;

AGGR_SHAPES

POLYGON  (( 10.00000000 8.00000000, 12.00000000 8.00000000, 12.00000000 10.00000000, 
10.00000000 10.00000000, 10.00000000 8.00000000))

SQLite

Erstellen Sie zunächst die Tabelle, in der die Lebensräume gespeichert sind.

CREATE TABLE habitats (
  id integer primary key autoincrement not null
);

SELECT AddGeometryColumn(
 NULL,
 'habitats',
 'shape',
 4326,
 'polygon',
 'xy',
 'null'
);

Fügen Sie anschließend der Tabelle die drei Polygone hinzu.

INSERT INTO habitats (shape) VALUES (
 st_polygon ('polygon ((5 5, 12 5, 12 10, 5 10, 5 5))', 4326)
);

INSERT INTO habitats (shape) VALUES (
 st_polygon ('polygon ((10 8, 14 8, 14 15, 10 15, 10 8))', 4326)
);

INSERT INTO habitats (shape) VALUES (
 st_polygon ('polygon ((6 8, 20 8, 20 20, 6 20, 6 8))', 4326)
);

Wählen Sie abschließend die Schnittmenge für die Lebensräume aus.

SELECT st_astext(st_aggr_intersection(shape)) 
  AS "AGGR_SHAPES" 
  FROM habitats;

AGGR_SHAPES

POLYGON  (( 10.00000000 8.00000000, 12.00000000 8.00000000, 12.00000000 10.00000000, 
10.00000000 10.00000000, 10.00000000 8.00000000))

Verwandte Themen

5/10/2014