3The EnvelopesIntersect function is no longer deprecated. Another
3function signature has been defined to remove the requirement to first create
3a polygon to represent a rectangular window with which to find all geometries
3that the window intersects. EnvelopesIntersect now takes a geometry,
3four type DOUBLE coordinate values that define the lower-left and upper-right
3corners of a rectangular window, and the spatial reference system
3identifier. EnvelopesIntersect returns 1 if the envelope of the first
3geometry intersects with the envelope defined by the four type DOUBLE
3values. Otherwise, 0 (zero) is returned. <
3Syntax
3>>-db2gse.EnvelopesIntersect--(--------------------------------->
3
3>--geometry--,--x_min--,--y_min--,--x_max--,--y_max--,--srs_id--)-><
3
3
3Parameters
3
- 3geometry
- 3A value of type ST_Geometry or one of its subtypes that represents the
3geometry that is to be tested.
- 3x_min
- 3Specifies the minimum X coordinate value for the envelope. You must
3specify a non-null value for this parameter.
3The data type of this parameter is DOUBLE.
- 3y_min
- 3Specifies the minimum Y coordinate value for the envelope. You must
3specify a non-null value for this parameter.
3The data type of this parameter is DOUBLE.
- 3x_max
- 3Specifies the maximum X coordinate value for the envelope. You must
3specify a non-null value for this parameter.
3The data type of this parameter is DOUBLE.
- 3y_max
- 3Specifies the minimum Y coordinate value for the envelope. You must
3specify a non-null value for this parameter.
3The data type of this parameter is DOUBLE.
- 3srs_id
- 3Uniquely identifies the spatial reference system. The spatial
3reference system identifier should match the spatial reference system
3identifier of the geometry parameter. You must specify a non-null value
3for this parameter.
3The data type of this parameter is INTEGER.
3
3Return type
3INTEGER
3Example
3This example creates two polygons that represent counties and then
3determines if any of them intersect a geographic area specified by the four
3type DOUBLE values.
3SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse
3CREATE TABLE counties (id INTEGER, name CHAR(20),
3 geometry ST_Polygon)
3
3INSERT INTO counties VALUES
3 (1, 'County_1', ST_Polygon('polygon((0 0, 30 0, 40 30,
3 40 35, 5 35, 5 10, 20 10, 20 5, 0 0))' ,0))
3
3INSERT INTO counties VALUES
3 (2, 'County_2', ST_Polygon('polygon((15 15, 15 20,
3 60 20, 60 15, 15 15))' ,0))
3
3INSERT INTO counties VALUES
3 (3, 'County_3', ST_Polygon('polygon((115 15, 115 20,
3 160 20, 160 15, 115 15))' ,0))
3
3
3SELECT name
3FROM counties as c
3WHERE EnvelopesIntersect(c.geometry, 15, 15, 60, 20, 0) =1
3
3Results:
3Name
3--------------------
3County_1
3County_2
3
3
3
3