ST_Buffer

Définition

ST_Buffer accepte un objet géométrie et une distance et retourne un objet géométrie qui est la zone tampon entourant l'objet source.

Syntaxe

sde.st_buffer (g1 sde.st_geometry, distance double_precision)

Type de retour

ST_Geometry

Exemple

Cet exemple crée deux tables, sensitive_areas et hazardous_sites, remplit ces tables, utilise ST_Buffer pour générer une zone tampon autour des polygones de la table hazardous_sites et trouve les zones de chevauchement entre ces zones tampons et les polygones sensitive_areas.

Oracle

CREATE TABLE sensitive_areas (id integer, 
                               zone sde.st_geometry); 

CREATE TABLE hazardous_sites (site_id integer, 
                             name varchar(40), 
                             location sde.st_geometry); 

INSERT INTO SENSITIVE_AREAS VALUES (
1,
sde.st_polygon ('polygon ((20 30, 30 30, 30 40, 20 40, 20 30))', 0)
);

INSERT INTO SENSITIVE_AREAS VALUES (
2,
sde.st_polygon ('polygon ((30 30, 30 50, 50 50, 50 30, 30 30))', 0)
);

INSERT INTO SENSITIVE_AREAS VALUES (
3,
sde.st_polygon ('polygon ((40 40, 40 60, 60 60, 60 40, 40 40))', 0)
);

INSERT INTO HAZARDOUS_SITES VALUES (
102,
'W. H. KleenareChemical Repository',
sde.st_pointfromtext ('point (60 60)', 0) 
); 

SELECT sa.id "Sensitive Areas", hs.name "Hazardous Sites"
FROM SENSITIVE_AREAS sa, HAZARDOUS_SITES hs
WHERE sde.st_overlaps (sa.zone, sde.st_buffer (hs.location, .01)) = 1;

PostgreSQL

CREATE TABLE sensitive_areas (id integer, 
                               zone sde.st_geometry); 

CREATE TABLE hazardous_sites (site_id integer, 
                             name varchar(40), 
                             location sde.st_geometry); 

INSERT INTO sensitive_areas VALUES (
1,
sde.st_polygon ('polygon ((20 30, 30 30, 30 40, 20 40, 20 30))', 0)
);

INSERT INTO sensitive_areas VALUES (
2,
sde.st_polygon ('polygon ((30 30, 30 50, 50 50, 50 30, 30 30))', 0)
);

INSERT INTO sensitive_areas VALUES (
3,
sde.st_polygon ('polygon ((40 40, 40 60, 60 60, 60 40, 40 40))', 0)
);

INSERT INTO hazardous_sites VALUES (
102,
'W. H. KleenareChemical Repository',
sde.st_point ('point (60 60)', 0) 
); 

SELECT sa.id AS "Sensitive Areas", hs.name 
AS "Hazardous Sites"
FROM sensitive_areas sa, hazardous_sites hs
WHERE sde.st_overlaps (sa.zone, sde.st_buffer (hs.location, .01)) = 't';

Sensitive Areas                Hazardous Sites
             3                W.H. KleenareChemical Repository

3/6/2012