ST_EnvIntersects

RemarqueRemarque :

ST_Geometry in Oracle only

Definition

ST_EnvIntersects returns 1 (true) if the envelopes of two ST_Geometries intersect; otherwise, it returns 0 (false).

Syntax

sde.st_envintersects (g1 sde.st_geometry, g2 sde.st_geometry)
sde.st_envintersects (g1 sde.st_geometry, minx number, miny number, maxx number, maxy number)

Return type

Integer (Boolean)

Example

This example searches for a parcel that has an envelope intersected by the defined polygon.

CREATE TABLE sample_geoms (id integer, geometry sde.st_geometry);

INSERT INTO SAMPLE_GEOMS VALUES (
1,
sde.st_geometry ('linestring (10 10, 50 50)', 0)
);

INSERT INTO SAMPLE_GEOMS VALUES (
2,
sde.st_geometry ('linestring (10 20, 50 60)', 0)
);

This SELECT statement compares the envelopes of two geometries and the geometries themselves to see whether the features or the envelopes intersect.

SELECT a.id, b.id, sde.st_intersects (a.geometry, b.geometry) Intersects, sde.st_envintersects (a.geometry, b.geometry) Envelope_Intersects
FROM SAMPLE_GEOMS a, SAMPLE_GEOMS b
WHERE a.id = 1
AND b.id=2; 

ID      ID      INTERSECTS   ENVELOPE_INTERSECTS

1       2       0            1

You could also specify an envelope to detect which features, if any, fall inside the envelope you pass in with the WHERE clause of the SELECT statement.

SELECT id
FROM SAMPLE_GEOMS
WHERE sde.st_envintersects(geometry, 5, 5, 60, 65) = 1;

ID 

1
2 

3/6/2012