A Oracle Spatial Command and API Reference
Syntax and example information for Oracle Spatial commands and APIs that apply to Event Processing are provided.
A.1 ANYINTERACT
The ANYINTERACT Oracle Spatial geometric relation operator returns true when the key interacts with the geometry (geom), and false otherwise.
Syntax
ANYINTERACT@spatial(geom, key, tol)
-
geom: Any supported geometry type. -
key: AGTYPE_POINT,GTYPE_CURVE,GTYPE_POLYGON,GTYPE_SURFACE,GTYPE_COLLECTION,GTYPE_MULTIPOINT,GTYPE_MULTICURVE,GTYPE_MULTIPOLYGON,GTYPE_SOLID, orGTYPE_MULTISOLIDgeometry type.The geometry type of this geometry must be
GTYPE_POINTor aRUNTIME_EXCEPTIONwill be thrown. -
tol: The tolerance as adoublevalue. The tolerance value expands the thickness of the boundaries.
Example
<view id="op_in_where"> RStream( select loc.customerId, shop.shopId from LocGeomStream[NOW] as loc, ShopGeomRelation as shop where ANYINTERACT@spatial(shop.geom, loc.curLoc, 5.0d) = true ) </view> <view id="op_in_proj"> RStream( select loc.customerId, shop.shopId, ANYINTERACT@spatial(shop.geom, loc.curLoc, 5.0d) from LocGeomStream[NOW] as loc, ShopGeomRelation as shop ) </view>
A.2 buffer
The com.oracle.cep.cartridge.spatial.Geometry buffer method returns a new oracle.spatial.geometry.JGeometry object that is the buffered version of the input geometry.
Syntax
-
bufferWidth: The distance value used for this buffer as adouble.This value is assumed to be in the same unit as the Unit of Projection for projected geometry. If the geometry is geodetic, this buffer width should be in meters.
-
SMA: The Semi Major Axis as adouble.Set this parameter when the geometry is geodetic.
-
iFlat: The Flattening from CS parameters as adouble.Set this parameter when the geometry is geodetic.
-
arcT: Thearc_tolerancefor geodetic arc densification as adouble.
com.oracle.cep.cartridge,spatial.geometry.buffer(bufferWidth, SMA, iFlat, actT)
Example
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.buffer(13, 2, 4, 7) from CustomerLocStream </view>
A.3 bufferPolygon
The com.oracle.cep.cartridge.spatial.Geometry bufferPolygon method returns a com.oracle.cep.cartridge.spatial.Geometry object that is the buffered version of the input oracle.spatial.geometry.JGeometry polygon. This method creates buffered polygons to a specified distance around the input features.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.bufferPolygon(polygon, distance)
-
polygon: Anoracle.spatial.geometry.JGeometrypolygon. -
distance: Adoublevalue that specifies the distance around the input features.The
distancevalue is assumed to be in the same unit as the Unit of Projection for projected geometry. If the geometry is geodetic, the bufferdistanceshould be in meters.
Example
This method obtains parameters from the Oracle Spatial application context. You must use the spatial link name (@spatial) to associate the method call with the Oracle Spatial application context See Oracle Spatial Application Context.
com.oracle.cep.cartridge.spatial.Geometry.bufferPolygon@spatial(geom, 1300)
The following example creates a buffered polygon. Because this example depends on the Oracle Spatial application context, it uses the spatial link name.
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.bufferPolygon@spatial(geom, 13) from CustomerLocStream </view>
A.4 CONTAIN
The Oracle Spatial geometric relation CONTAIN operator returns true when a geometry is contained by another geometry, and false otherwise.
Syntax
CONTAIN@spatial(geom, key)
-
geom: Any supported geometry type. -
key: AGTYPE_POINT,GTYPE_CURVE,GTYPE_POLYGON,GTYPE_SURFACE,GTYPE_COLLECTION,GTYPE_MULTIPOINT,GTYPE_MULTICURVE,GTYPE_MULTIPOLYGON,GTYPE_SOLID, orGTYPE_MULTISOLIDgeometry type.
Example
<view id="op_in_where"> RStream( select loc.customerId, shop.shopId from LocGeomStream[NOW] as loc, ShopGeomRelation as shop where CONTAIN@spatial(shop.geom, loc.curLoc, 5.0d) = true ) </view> <view id="op_in_proj"> RStream( select loc.customerId, shop.shopId, CONTAIN@spatial(shop.geom, loc.curLoc, 5.0d) from LocGeomStream[NOW] as loc, ShopGeomRelation as shop ) </view>
A.5 convertTo2D
The com.oracle.cep.cartridge.spatial.Geometry convertTo2D method converts an oracle.spatial.geometry.JGeometry 3D object to an oracle.spatial.geometry.JGeometry 2D object.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.convertTo2D(geom)
The geom parameter is an oracle.spatial.geometry.JGeometry 3D object.
Example
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.convertTo2D(geom) from CustomerLocStream </view>
A.6 convertTo3D
The com.oracle.cep.cartridge.spatial.Geometry convertTo3D method converts an oracle.spatial.geometry.JGeometry 2D object into an oracle.spatial.geometry.JGeometry 3D object. The conversion pads z coordinates to zero.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.convertTo3D(geom)
The geom parameter is an oracle.spatial.geometry.JGeometry 2D object.
Example
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.convertTo3D(geom) from CustomerLocStream </view>
A.7 createCircle
The com.oracle.cep.cartridge.spatial.Geometry createCircle method returns a com.oracle.cep.cartridge.spatial.Geometry object that is a 2D or 3D circle.
Create a 2D Circle Syntax
com.oracle.cep.cartridge.spatial.Geometry.createCircle(x, y, radius) com.oracle.cep.cartridge.spatial.Geometry.createCircle(x, y, radius, srid)
-
x: The x ordinate of the circle's center as adouble. -
y: The y ordinate of the circle's center as adouble. -
radius: Thearc_tolerancefor geodetic arc densification as adouble. -
srid: The optionalSDO_SRIDof the circle as anint. When thesridparameter is omitted, add the spatial link name as shown in the examples.
Create a 3D Circle Syntax
com.oracle.cep.cartridge.spatial.Geometry.createCircle(x1, y1, x2, y2, x3, y3)
com.oracle.cep.cartridge.spatial.Geometry.createCircle(srid, x1, y1, x2, y2, x3,
y3)Specify three coordinates to form the circumference with the following arguments:
-
x1: The x ordinate of point 1 as adouble. -
y1: The y ordinate of point 1 as adouble. -
x2: The x ordinate of point 2 as adouble. -
y2: The y ordinate of point 2 as adouble. -
x3: The x ordinate of point 3 as adouble. -
y3: The y ordinate of point 3 as adouble. -
srid: The optionalSRIDof the circle as anint. When you omit thesridparameter, add the spatial link name (@spatial) as shown in the examples.
Examples
If you omit the optional srid parameter, then the method obtains parameters from the Oracle Spatial data cartridge application context. In this case, use the spatial link name (@spatial) to associate the method call with the Oracle Spatial data cartridge application context. See Oracle Spatial Application Context
com.oracle.cep.cartridge.spatial.Geometry.createCircle@spatial(x, y)
The following example creates a 2D circle with the srid parameter. Because this example uses the srid parameter, it does not need the spatial link name.
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.createCircle(x, y, 300, srid) from CustomerLocStream </view>
A.8 createElemInfo
The com.oracle.cep.cartridge.spatial.Geometry createElemInfo method returns a single element info value as an int[] from the given arguments. See einfogenerator for an alternative.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.createElemInfo(offset, etype, interp)
-
soffset: The offset, as anint, within the ordinates array where the first ordinate for this element is stored.SDO_STARTING_OFFSETvalues start at 1 and not at 0. Thus, the first ordinate for the first element will be atSDO_GEOMETRY.Ordinates(1). If there is a second element, its first ordinate will be atSDO_GEOMETRY.Ordinates(n* 3 + 2), wherenreflects the position within theSDO_ORDINATE_ARRAYdefinition. -
etype: The type of the element as anint.Oracle Spatial supports
SDO_ETYPEvalues 1, 1003, and 2003 are considered simple elements (not compound types). They are defined by a single triplet entry in the element info array. These types are:-
1: point.
-
1003: exterior polygon ring (must be specified in counterclockwise order).
-
2003: interior polygon ring (must be specified in clockwise order).
These types are further qualified by the
SDO_INTERPRETATION.Note:
Do not mix 1-digit and 4-digit
SDO_ETYPEvalues in the same geometry. -
-
interp: The interpretation as anint.For an
SDO_ETYPEthat is a simple element (1, 1003, or 2003), theSDO_INTERPRETATIONattribute determines how the sequence of ordinates for this element is interpreted. For example, a polygon boundary may be made up of a sequence of connected straight line segments.If a geometry consists of more than one element, then the last ordinate for an element is always one less than the starting offset for the next element. The last element in the geometry is described by the ordinates from its starting offset to the end of the ordinates varying length array.
Table A-1 describes the relationship between
SDO_ETYPEandSDO_INTERPREATION.Table A-1 SDO_ETYPE and SDO_INTERPRETATION
SDO_ETYPE SDO_INTERPRETATION Description 0
Any numeric value
Use to model geometry types not supported by Oracle Spatial.
1
1
Point type.
1
0
Orientation for an oriented point.
1003 or 2003
1
Simple polygon with vertices connected by straight line segments. You must specify a point for each vertex; and the last point specified must be exactly the same point as the first (within the tolerance value), to close the polygon.
For example, for a 4-sided polygon, specify 5 points, with point 5 the same as point 1.
1003 or 2003
3
Rectangle type (optimized rectangle). A bounding rectangle such that only two points, the lower-left and the upper-right, are required to describe it. The rectangle type can be used with geodetic or non-geodetic data. However, with geodetic data, use this type only to create a query window (not for storing objects in the database).
Example
<view id="ShopGeom">
select com.oracle.cep.cartridge.spatial.Geometry.createGeometry@spatial(
com.oracle.cep.cartridge.spatial.Geometry.GTYPE_POLYGON,
com.oracle.cep.cartridge.spatial.Geometry.createElemInfo(1, 1003, 1),
ordsgenerator@spatial(
lng1, lat1, lng2, lat2, lng3, lat3,
lng4, lat4, lng5, lat5, lng6, lat6
)
) as geom
from ShopDesc
</view>
A.9 createGeometry
The com.oracle.cep.cartridge.spatial.Geometry createGeometry method returns a new 2D oracle.cep.cartridge.spatial.Geometry object.
Syntax
com.oracle.cep.cartridge.spatial.Geometry(gtype, elemInfo, ordinates) com.oracle.cep.cartridge.spatial.Geometry(gtype, srid, elemInfo, ordinates)
-
gtype: The geometry type as anint.For more information, see Table A-2.
-
eleminfo: The geometry element info as anint[].For more information, see createElemInfo.
-
ordinates: The geometry ordinates as adouble[]. -
srid: The optionalSDO_SRIDof the geometry as anint. When you omit thesridparameter, add the spatial link name (@spatial) as shown in the examples.
Examples
If you omit the srid parameter, then this method obtains parameters from the Oracle Spatial application context. In this case, you must use the spatial link name to associate the method call with the Oracle Spatial application context: For more information, see Oracle Spatial Application Context.
com.oracle.cep.cartridge.spatial.Geometry.createGeometry@spatial(gtype, eleminfo,
ordinates)
The following examples creates a geometry with the srid parameter. Because this example uses the srid argument, it does not need the @spatial link name.
<view id="ShopGeom">
select com.oracle.cep.cartridge.spatial.Geometry.createGeometry(
com.oracle.cep.cartridge.spatial.Geometry.GTYPE_POLYGON,
srid,
com.oracle.cep.cartridge.spatial.Geometry.createElemInfo(1, 1003, 1,
srid),
ordsgenerator@spatial(
lng1, lat1, lng2, lat2, lng3, lat3,
lng4, lat4, lng5, lat5, lng6, lat6
)
) as geom
from ShopDesc
</view>A.10 createLinearLineString
The com.oracle.cep.cartridge.spatial.Geometry createLinearLineString method returns a new 3D com.oracle.cep.cartridge.spatial.Geometry geometry that is a linear line string with element info of {1, 2, 1}. If the dimensionality of the given coordinates is 2, the z coordinates are padded to zero.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.createLinearLineString(coords, dim)
com.oracle.cep.cartridge.spatial.Geometry.createLinearLineString(srid, coords,
dim)-
coords: The coordinates of the linear line string as adouble[]. -
dim: The dimensionality of the given coordinates as anint. -
srid: The optionalSDO_SRIDof the geometry as anint. When the srid parameter is omitted, add the spatial link name as shown in the examples.For more information, see Oracle Spatial Application Context.
Examples
If you omit the srid parameter, then this method obtains parameters from the Oracle Spatial data cartridge application context. You must use the spatial link name (@spatial) to associate the method call with the Oracle Spatial data cartridge application context. See Oracle Spatial Application Context.
com.oracle.cep.cartridge.spatial.Geometry.createLinearLineString@spatial(coords,
dim)
The following examples creates a linear line string with the srid paramter. Because this example uses the srid parameter, it does not use the @spatial link.
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.createLinearLineString(coords, dim, srid) from CustomerLocStream </view>
A.11 createLinearMultiLineString
The com.oracle.cep.cartridge.spatial.Geometry createMultiLineString method returns a new 3D com.oracle.cep.cartridge.spatial.Geometry geometry that is a linear multiline string. If the dimensionality of the given coordinates is 2, then the z coordinates are padded to zero.
Syntax
com.oracle.oep.cartridge.spatial.Geometry.createMultiLineString(coords, dim) com.oracle.cep.cartridge.spatial.Geometry.createMultiLineString(srid, coords, dim)
-
coords: the coordinates of the linear line string as adouble[][]. -
dim: the dimensionality of the given coordinates as anint. -
srid: the optionalSRIDof the geometry as anint. When you omit the srid parameter, add the spatial link name (@spatial) as shown in the examples.
Examples
If you omit the srid parameter, then this method obtains parameters from the Oracle Spatial data cartridge application context. You must use the spatial link name (@spatial) to associate the method call with the Oracle Spatial data cartridge application context. See Oracle Spatial Application Context.
com.oracle.cep.cartridge.spatial.Geometry.createLinearMultiLineString@spatial(
coords, dim)
The following example creates a linear multiline linear string. Because this example uses the srid argument, it does not use the spatial link name.
<view id="LocGeomStream" schema="customerId curLoc">
select
customerId,
com.oracle.cep.cartridge.spatial.Geometry.createLinearMultiLineString(coords, dim,
srid)
from
CustomerLocStream
</view>A.12 createLinearPolygon
The com.oracle.cep.cartridge.spatial.Geometry createLinearPolygon method returns a new com.oracle.cep.cartridge.spatial.Geometry object that is a 2D simple linear polygon without holes. If the coordinate array does not close itself (the last coordinate is not the same as the first), then this method copies the first coordinate and appends this coordinate value to the end of the input coordinates array.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.createLinearPolygon(coords{])
com.oracle.cep.cartridge.spatial.Geometry.createLinearPolygon(srid, coords[])
-
coords: the coordinates of the linear polygon as adouble[]. -
srid: the optionalSRIDof the geometry as anint. When you omit the srid parameter, add the spatial link name (@spatial) as shown in the examples.
Examples
If you omit the srid parameter, then the method obtains parameters from the Oracle Spatial application context. In this case, you must use the spatial link name (@spatial) to associate the method call with the Oracle Spatial application context. See Oracle Spatial Application Context.
com.oracle.cep.cartridge.spatial.Geometry.createLinearPolygon@spatial(coords)
The following example creates a linear polygon with the srid parameter. Because this example uses the srid argument, it does not use the spatial link name.
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.createLinearPolygon(coords, srid) from CustomerLocStream </view>
A.13 createMultiPoint
The com.oracle.cep.cartridge.spatial.Geometry createMultiPoint method returns a com.oracle.cep.cartridge.spatial.Geometry object which is a multipoint geometry
Syntax
com.oracle.cep.cartridge.spatial.Geometry.createMultiPoint(coords[][], dim) com.oracle.cep.cartridge.spatial.Geometry.createMultiPoint(srid, coords[][], dim)
-
coords: the array of arrays of typedoubleeach containing one point. -
dim: the dimensionality of each point as anint. -
srid: the optionalSRIDof the geometry as anint. When you omit the srid parameter, add the spatial link name (@spatial) as shown in the examples.
Examples
If you omit the srid parameter, then this method obtains parameters from the Oracle Spatial data cartridge application context. In this case, you must use the spatial link name (@spatial) to associate the method call with the Oracle Spatial data cartridge application context. See Oracle Spatial Application Context.
com.oracle.cep.cartridge.spatial.Geometry.createMultiPoint@spatial(coords, dim)
The following example creates a multipoint geometry with the srid parameter. Because this example uses the srid parameter, it does not use the spatial link name.
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.createMultiPoint(coords, dim, srid) from CustomerLocStream </view>
A.14 createPoint
The com.oracle.cep.cartridge.spatial.Geometry createPoint method returns a new com.oracle.cep.cartridge.spatial.Geometry object that is a 3D point.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.createPoint(x, y) com.oracle.cep.cartridge.spatial.Geometry.createPoint(srid, x, y)
-
x: the x coordinate of the lower left as adouble. -
y: the y coordinate of the lower left as adouble. -
srid: the optionalSRIDof the geometry as anint. When you omit thesridparameter, add the spatial link name (@spatial) as shown in the examples.
If you omit the srid parameter, then this method obtains parameters from the Oracle Spatial application context. In this case, you must use the spatial link name (@spatial) to associate the method call with the Oracle Spatial application context. See Oracle Spatial Application Context
com.oracle.cep.cartridge.spatial.Geometry.createPoint@spatial(x, y)
The following example creates a point with the srid parameter. Because this example uses the srid parameter, it does not use the spatial link name.
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.createPoint(lng, lat, srid) from CustomerLocStream </view>
A.15 createRectangle
The com.oracle.cep.cartridge.spatial.Geometry createRectangle method returns a new com.oracle.cep.cartridge.spatial.Geometry object that is a 2D rectangle
Syntax
com.oracle.cep.cartridge.spatial.Geometry.createRectangle(x1, y1, x2, y2) com.oracle.cep.cartridge.spatial.Geometry.createRectangle(srid, x1, y1, x2, y2)
-
x1: the x coordinate of the lower left as adouble. -
y1: the y coordinate of the lower left as adouble. -
x2: the x coordinate of the upper right as adouble. -
y2: the y coordinate of the upper right as adouble. -
srid: the optionalSRIDof the geometry as anint.
Examples
If you omit the srid parameter, then this method obtains parameters from the Oracle Spatial application context. In this case, you must use the spatial link name (@spatial) to associate the method call with the Oracle Spatial application context. See Oracle Spatial Application Context.
com.oracle.cep.cartridge.spatial.Geometry.createRectangle@spatial(x1, y1, x2, y2)
The following example creates a rectangle. Because this example uses the srid parameter, it does not need the spatial link name.
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.createRectangle(x1, y1, x2, y2, srid) from CustomerLocStream </view>
A.16 distance
The com.oracle.cep.cartridge.spatial.Geometry distance method calculates the distance between two geometries as a double.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.distance(g1, g2) com.oracle.cep.cartridge.spatial.Geometry.distance(geoParam, g1, g2)
To calculate the distance between a com.oracle.cep.cartridge.spatial.Geometry object and another, use the non-static distance method of the current Geometry object with the following arguments:
-
g: the othercom.oracle.cep.cartridge.spatial.Geometryobject.
To calculate the distance between two com.oracle.cep.cartridge.spatial.Geometry objects, use the static distance method with the following arguments:
-
g1: the firstcom.oracle.cep.cartridge.spatial.Geometryobject. -
g2: the secondcom.oracle.cep.cartridge.spatial.Geometryobject.
Examples
This method obtains parameters from the Oracle Spatial application context. You must use the spatial link name to associate the method call with the Oracle Spatial application context. See Oracle Spatial Application Context.
com.oracle.cep.cartridge.spatial.Geometry.distance@spatial(geom) com.oracle.cep.cartridge.spatial.Geometry.distance@spatial(geom1, geom2)
The following example calculates the distance between two geometries. Because the distance method depends on the Oracle Spatial application context, it must use the spatial link name.
<view id="LocGeomStream" schema="customerId curLoc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.createRectangle(x1, y1, x2, y2, srid) from CustomerLocStream where com.oracle.cep.cartridge.spatial.Geometry.distance@spatial(geom1, geom2) < 5 </view>
A.17 einfogenerator
The einfogenerator Oracle CQL function returns a single info element value as in int[] from the given arguments. Alternately, see createElemInfo if you prefer to use the com.oracle.cep.cartridge.spatial.Geometry.createElemInfo method.
Syntax
einfogenerator@spatial(offset, etype, interp)
-
offset: the offset, as anint, within the ordinates array where the first ordinate for this element is stored.SDO_STARTING_OFFSETvalues start at 1 and not at 0. Thus, the first ordinate for the first element will be atSDO_GEOMETRY.Ordinates(1). If there is a second element, its first ordinate will be atSDO_GEOMETRY.Ordinates(n* 3 + 2), wherenreflects the position within theSDO_ORDINATE_ARRAYdefinition. -
etype: the type of the element as anint.Oracle Spatial supports
SDO_ETYPEvalues 1, 1003, and 2003 are considered simple elements (not compound types). They are defined by a single triplet entry in the element info array. These types are:-
1: point.
-
1003: exterior polygon ring (must be specified in counterclockwise order).
-
2003: interior polygon ring (must be specified in clockwise order).
These types are further qualified by the
SDO_INTERPRETATION.Note:
You cannot mix 1-digit and 4-digit
SDO_ETYPEvalues in a single geometry. -
-
interp: the interpretation as anint.For an
SDO_ETYPEthat is a simple element (1, 1003, or 2003) theSDO_INTERPRETATIONattribute determines how the sequence of ordinates for this element is interpreted. For example, a polygon boundary may be made up of a sequence of connected straight line segments.If a geometry consists of more than one element, then the last ordinate for an element is always one less than the starting offset for the next element. The last element in the geometry is described by the ordinates from its starting offset to the end of the ordinates varying length array.
Table A-2 describes the relationship between
SDO_ETYPEandSDO_INTERPREATION.Table A-2 SDO_ETYPE and SDO_INTERPRETATION
SDO_ETYPE SDO_INTERPRETATION Description 0
Any numeric value
Used to model geometry types not supported by Oracle Spatial.
1
1
Point type.
1
0
Orientation for an oriented point.
1003 or 2003
1
Simple polygon whose vertices are connected by straight line segments. You must specify a point for each vertex; and the last point specified must be exactly the same point as the first (within the tolerance value), to close the polygon.
For example, for a 4-sided polygon, specify 5 points, with point 5 the same as point 1.
1003 or 2003
3
Rectangle type (sometimes called optimized rectangle). A bounding rectangle such that only two points, the lower-left and the upper-right, are required to describe it. The rectangle type can be used with geodetic or non-geodetic data. However, with geodetic data, use this type only to create a query window (not for storing objects in the database).
Examples
This is an Oracle CQL function so you invoke this function with the spatial link name and without a package prefix. The following example creates the element information for a geometry.
view id="ShopGeom">
select com.oracle.cep.cartridge.spatial.Geometry.createGeometry@spatial(
com.oracle.cep.cartridge.spatial.Geometry.GTYPE_POLYGON,
einfogenerator@spatial(1, 1003, 1),
ordsgenerator@spatial(
lng1, lat1, lng2, lat2, lng3, lat3,
lng4, lat4, lng5, lat5, lng6, lat6
)
) as geom
from ShopDesc
</view>A.18 FILTER
The FILTER Oracle Spatial geometric filter operator returns true for object pairs that are non-disjoint, and false otherwise.
FILTER@spatial(key, tol)
-
key: AGTYPE_POINT,GTYPE_CURVE,GTYPE_POLYGON,GTYPE_SURFACE,GTYPE_COLLECTION,GTYPE_MULTIPOINT,GTYPE_MULTICURVE,GTYPE_MULTIPOLYGON,GTYPE_SOLID, orGTYPE_MULTISOLIDgeometry type. -
tol: the tolerance as adoublevalue.
Example
This is an Oracle Spatial geometric filter operator so you invoke this function with the spatial link name and without a package prefix. The following example test for object pairs that are non-disjoint.
<view id="filter"> RStream( select loc.customerId, shop.shopId from LocGeomStream[NOW] as loc, ShopGeomRelation as shop where FILTER@spatial(loc.curLoc, 5.0d) = true ) </view>
A.19 get2dMbr
The com.oracle.cep.cartridge.spatial.Geometry get2dMbr method returns the Minimum Bounding Rectangle (MBR) of a given Geometry as a double[][].
Syntax
com.oracle.cep.cartridge.spatial.Geometry.get2DMbr(geom)
The geom parameter is a com.oracle.cep.cartridge.spatial.Geometry object for which the method returns the bounding rectangle. The returned bounding rectangle contains the following values:
-
[0][0]:minX -
[0][1]:maxX -
[1][0]:minY -
[1][1]:maxY
Examples
The following example returns a bounding rectangle for geom.
<view id="LocGeomStream" schema="customerId mbr"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.get2dMbr(geom) from CustomerLocStream where com.oracle.cep.cartridge.spatial.Geometry.distance@spatial(geom1, geom2) < 5 </view>
A.20 INSIDE
The INSIDE Oracle Spatial geometric relation returns true if GTYPE_POINT is inside the geometry, and false otherwise.
Syntax
INSIDE@spatial(geom, key)
-
geom: any supported geometry type. -
key: AGTYPE_POINT,GTYPE_CURVE,GTYPE_POLYGON,GTYPE_SURFACE,GTYPE_COLLECTION,GTYPE_MULTIPOINT,GTYPE_MULTICURVE,GTYPE_MULTIPOLYGON,GTYPE_SOLID, orGTYPE_MULTISOLIDgeometry type.
Example
The following Oracle CQL query tests whether a point is inside the geometry.
<view id="op_in_where"> RStream( select loc.customerId, shop.shopId from LocGeomStream[NOW] as loc, ShopGeomRelation as shop where INSIDE@spatial(shop.geom, loc.curLoc, 5.0d) = true ) </view> <view id="op_in_proj"> RStream( select loc.customerId, shop.shopId, INSIDE@spatial(shop.geom, loc.curLoc, 5.0d) from LocGeomStream[NOW] as loc, ShopGeomRelation as shop ) </view>
A.21 INSIDE3D
The INSIDE3D Oracle Spatial geometric relation returns true if the 3D geometry, geom1, is inside the 3D space of geom2, and false otherwise.
Syntax
INSIDE3D@spatial(geom1, geom2) INSIDE3D@spatial(geom1, geom2)
-
geom1: The contained geometry, which can be any supported 3D geometry. -
geom2:The containing geometry, which can be any supported 3D geometry.
Example
The following Oracle CQL query tests whether a point is inside a 3D geometry.
<view id="op_in_where"> RStream( select loc.customerId, shop.shopId from LocGeomStream[NOW] as loc, ShopGeomRelation as shop where INSIDE3D@spatial(shop.geom1, shop.geom2) = true ) </view> <view id="op_in_proj"> RStream( select loc.customerId, shop.shopId, INSIDE@spatial(shop.geom1, shop.geom2) from LocGeomStream[NOW] as loc, ShopGeomRelation as shop ) </view>
A.22 NN
The NN Oracle Spatial geometric filter operator returns the objects (nearest neighbors) from geom that are nearest to the key. To determine how near two geometry objects are to each other, Oracle Event Processing uses the shortest possible distance between any two points on the surface of each object used.
Syntax
NN@spatial(geom, key, tol)
-
geom: any supported geometry type. -
key: AGTYPE_POINT,GTYPE_CURVE,GTYPE_POLYGON,GTYPE_SURFACE,GTYPE_COLLECTION,GTYPE_MULTIPOINT,GTYPE_MULTICURVE,GTYPE_MULTIPOLYGON,GTYPE_SOLID, orGTYPE_MULTISOLIDgeometry type. -
tol: the tolerance as adoublevalue.
Examples
The following Oracle CQL query tests for nearest neighbors.
<view id="filter"> RStream( select loc.customerId, shop.shopId from LocGeomStream[NOW] as loc, ShopGeomRelation as shop where NN@spatial(shop.geom, loc.curLoc, 5.0d) = true ) </view>
A.23 ordsgenerator
The ordsgenerator Oracle CQL function returns a double array of 2D coordinates from coordinate parameter values.
Syntax
ordsgenerator@spatial(x1, y1, ..., xN, yN)
The parameter values form a comma-separated list of coordinate values. This function returns a double array of 2D coordinates from the input.
Example
The following example creates an Oracle Spatial double array out of six double coordinate values.
view id="ShopGeom"> select com.oracle.cep.cartridge.spatial.Geometry.createGeometry@spatial( com.oracle.cep.cartridge.spatial.Geometry.GTYPE_POLYGON, com.oracle.cep.cartridge.spatial.Geometry.createElemInfo(1, 1003, 1), ordsgenerator@spatial( lng1, lat1, lng2, lat2, lng3, lat3, lng4, lat4, lng5, lat5, lng6, lat6 ) ) as geom from ShopDesc </view>
A.24 to_Geometry
The com.oracle.cep.cartridge.spatial.Geometry to_Geometry method converts an oracle.spatial.geometry.JGeometry type to a 3D com.oracle.cep.cartridge.spatial.Geometry type.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.to_Geometry(geom)
The geom parameter is the oracle.spatial.geometry.JGeometry object to convert. If the given geometry is already a Geometry type and a 3D geometry, then no conversion is done. If the given geometry is a 2D geometry, then the given geometry is converted to 3D by padding z coordinates.
Example
The following example converts the 2D geometry, geo, to a 3D geometry.
<view id="LocStream" schema="customerId loc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.to_Geometry(geom) from CustomerLocStream </view>
A.25 to_J3D_Geometry
The com.oracle.cep.cartridge.spatial.Geometry to_J3D_Geometry method converts a com.oracle.cep.cartridge.spatial.Geometry object to an oracle.spatial.geometry.J3D_Geometry object.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.to_J3D_Geometry(g)
The g parameter is the com.oracle.cep.cartridge.spatial.Geometry object to convert.
Example
The following example shows how to use the to_J3D_Geometry method.
<view id="LocStream" schema="customerId loc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.to_J3D_Geometry(geom) from CustomerLocStream </view>
A.26 to_JGeometry
The com.oracle.cep.cartridge.spatial.Geometry.to_JGeometry method converts a com.oracle.cep.cartridge.spatial.Geometry object to an oracle.spatial.geometry.JGeometry 2D type.
Syntax
com.oracle.cep.cartridge.spatial.Geometry.to_JGeometry(g)
The g parameter is the com.oracle.cep.cartridge.spatial.Geometry object to convert.
Example
The following example converts the 2D geometry object, geom, to a 2D JGeometry object.
<view id="LocStream" schema="customerId loc"> select customerId, com.oracle.cep.cartridge.spatial.Geometry.to_JGeometry(geom) from CustomerLocStream </view>
A.27 WITHINDISTANCE
The WITHINDISTANCE Oracle CQL query returns true when the GTYPE_POINT is within the given distance of the geometry, and false otherwise.
Syntax
WITHINDISTANCE@spatial(geom, key, dist)
-
geom: any supported geometry type. -
key: AGTYPE_POINT,GTYPE_CURVE,GTYPE_POLYGON,GTYPE_SURFACE,GTYPE_COLLECTION,GTYPE_MULTIPOINT,GTYPE_MULTICURVE,GTYPE_MULTIPOLYGON,GTYPE_SOLID, orGTYPE_MULTISOLIDgeometry type. -
dist: the distance as adoublevalue.
Example
The following Oracle CQL query tests whether loc.curLoc is within the 5.0d distance of shop.geom.
<view id="op_in_where"> RStream( select loc.customerId, shop.shopId from LocGeomStream[NOW] as loc, ShopGeomRelation as shop where WITHINDISTANCE@spatial(shop.geom, loc.curLoc, 5.0d) = true ) </view> <view id="op_in_proj"> RStream( select loc.customerId, shop.shopId, WITHINDISTANCE@spatial(shop.geom, loc.curLoc, 5.0d) from LocGeomStream[NOW] as loc, ShopGeomRelation as shop ) </view>