This extension provides geo data related functionality such as checking whether a given geo coordinate is within a predefined geo-fence, etc. Following are the functions of the Geo extension.
Intersects function
Syntax | <bool> geo:intersects (<string> geoJSONGeometry , <string> geoJSONGeometryFence ) |
---|
Extension Type | Function |
---|
Description | Returns true if the geoJSONGeometry incoming event intersects the given string (i.e., geoJSONGeometryFence ). Returns false otherwise. |
---|
Example | intersects( {'type':'Polygon','coordinates':[[[0.5, 0.5],[0.5, 1.5],[1.5, 1.5],[1.5, 0.5],[0.5, 0.5]]]} , {'type':'Polygon','coordinates':[[[0, 0],[0, 1],[1, 1],[1, 0],[0, 0]]]} ), returns true because geoJSONGeometry intersects geoJSONGeometryFence . |
---|
Syntax | <bool> geo:intersects (<double> longitude , <double> latitude , <string> geoJSONGeometryFence ) |
---|
Extension Type | Function |
---|
Description | Returns true if the location specified in terms of longitude and latitude intersects the given geoJSONGeometryFence . Returns false otherwise. |
---|
Example | intersects(0.5. 0.5 , {'type':'Polygon','coordinates':[[[0, 0],[0, 1],[1, 1],[1, 0],[0, 0]]]}), returns true because the location specified in terms of longitude and latitude intersects geoJSONGeometryFence . |
---|
Within function
Syntax | <bool> geo:within (<double> longitude , <double> latitude, <string> geoJSONGeometryFence ) |
---|
Extension Type | Function |
---|
Description | Returns true if the location specified in terms of longitude and latitude is within the geoJSONGeometryFence . |
---|
Examples | within(0.5, 0.5, {'type':'Polygon','coordinates':[[[0,0],[0,2],[1,2],[1,0],[0,0]]]} ) returns true .within(2, 2, {'type':'Polygon','coordinates':[[[0,0],[0,2],[1,2],[1,0],[0,0]]]} ) returns false .
|
---|
Syntax | <bool> geo:within (<string> geoJSONGeometry , <string> geoJSONGeometryFence ) |
---|
Extension Type | Function |
---|
Description | Returns true if the geoJSONGeometry is within the geoJSONGeometryFence . Returns false otherwise. |
---|
Example | within( {'type': 'Circle', 'radius': 110575, 'coordinates':[1.5, 1.5]} , {'type':'Polygon','coordinates':[[[0,0],[0,4],[3,4],[3,0],[0,0]]]} ) returns true .within( {'type': 'Circle', 'radius': 110575, 'coordinates':[0.5, 1.5]} , {'type':'Polygon','coordinates':[[[0,0],[0,4],[3,4],[3,0],[0,0]]]} ) returns false .
|
---|
Within Distance function
Syntax | <bool> geo:withindistance (<double> longitude , <double> latitude, <string> geoJSONGeometryFence ) |
---|
Extension Type | Function |
---|
Description | Returns true if the location specified in terms of longitude and latitude is within distance of the geoJSONGeometryFence . Returns false otherwise. |
---|
Example | withindistance( 0.5 , 0.5, {'type':'Polygon','coordinates':[[[0, 0],[0, 1],[1, 1],[1, 0],[0, 0]]]}, 110574.61087757687) returns true because the location specified in terms of longitude and latitude is within the distance of the geoJSONGeometryFence . |
---|
Syntax | <bool> geo:withindistance (<string> geoJSONGeometry , <string> geoJSONGeometryFence , <double> distance ) |
---|
Extension Type | Function |
---|
Description | Returns true if the area given by geoJSONGeometry is within distance of the geoJSONGeometryFence . |
---|
Example | withindistance( {'type':'Polygon','coordinates':[[[0.5, 0.5],[0.5, 1.5],[1.5, 1.5],[1.5, 0.5],[0.5, 0.5]]]} , {'type':'Polygon','coordinates':[[[0, 0],[0, 1],[1, 1],[1, 0],[0, 0]]]}, 110574.61087757687) returns true because geoJSONGeometry is within the distance of geoJSONGeometryFence . |
---|
Crosses function
Syntax | <bool> geo:crosses (<string> id , <double> longitude, <double> latitude , <string> geoJSONGeometryFence ) |
---|
Extension Type | Function |
---|
Description | Returns true when the the specified object of which the location is specified in terms of longitude and latitude crosses the geographic location specified in geoJSONGeometryFence . Returns false when the object crosses out of the location specified in geoJSONGeometryFence . |
---|
Example | crosses(km-4354, -0.5, 0.5, {'type':'Polygon','coordinates':[[[0, 0],[2, 0],[2, 1],[0, 1],[0, 0]]]} ) returns true .km-4354, 1.5, 0.5, {'type':'Polygon','coordinates':[[[0, 0],[2, 0],[2, 1],[0, 1],[0, 0]]]} ) returns true .
|
---|
Syntax | <bool> geo:crosses (<string> id , <string> geoJSONGeometry , <string> geoJSONGeometryFence ) |
---|
Extension Type | StreamProcessor |
---|
Description | Returns true when the object (i.e. geoJSONGeometry ) crosses the specified geographic location (i.e. geoJSONGeometryFence ). Returns false when the object crosses out of geoJSONGeometryFence . |
---|
Stationary function
Syntax | <bool> geo:stationary (<string> id , <double> longitude, <double> latitude , <string> geoJSONGeometryFence , <double> radius ) |
---|
Extension Type | StreamProcessor |
---|
Description | Returns true when the object (defined in terms of longitude and latitude ) becomes stationary within the specified radius . Returns false when the object moves out of the specified radius. |
---|
Example | stationary(km-4354,0,0, 110574.61087757687) returns true .stationary(km-4354,1,1, 110574.61087757687) returns true .
stationary(km-4354,1,1.5, 110574.61087757687) returns true .
|
---|
Syntax | <bool> geo:stationary (<string> id , <string> geoJSONGeometry , <string> geoJSONGeometryFence , <double> radius ) |
---|
Extension Type | StreamProcessor |
---|
Description | Returns true when the object (i.e. geoJSONGeometry ) becomes stationary within the specified radius . Returns false when the objects moves out of the specified radius. |
---|
Proximity function
Syntax | <bool,string> geo:proximity (<string> id , <double> longitude, <double> latitude , <string> geoJSONGeometryFence , <double> radius ) |
---|
Extension Type | StreamProcessor |
---|
Description | Returns true when two objects (specified in terms of longitude and latitude) are within the specified radius to another object. Returns false when the specified object moves out of the specified radius . The proximityWith optional attribute indicates the ID of the object that the object specified is in close proximity with. proximityID is a unique ID for the two objects in close proximity. |
---|
Example | The following return true with id 3 . proximity(1, 0, 0, 110574.61087757687) proximity(2, 1, 1, 110574.61087757687) proximity(3, 2, 2, 110574.61087757687) proximity(1, 1.5, 1.5, 110574.61087757687)
|
---|
Syntax | <bool> proximity (<string> id , <string> geoJSONGeometry , <string> geoJSONGeometryFence , <double> radius ) |
---|
Extension Type | StreamProcessor |
---|
Description | Returns true when an object (i.e. geoJSONGeometry ) is within the specified radius from another object. Returns false when one or both objects move away from each other and are no longer within the specified radiu s of each other. The proximityWith optional attribute indicates the ID of the object that the object specified is in close proximity with. proximityID is a unique ID for the two objects in close proximity. |
---|
Geo Coordinates function
Syntax | <double, double, string> geocode (<string> location ) |
---|
Extension Type | StreamProcessor |
---|
Description | Transforms a location to its geo-coordinates ( longitude and latitude ) and formatted address. |
---|
Example | geocode(duplication rd) returns the following data with adherring latitude, longitude, and formattedAddress attribute names respectively.
6.8995244d, 79.8556202d, "R A De Mel Mawatha, Colombo, Sri Lanka"
|
---|
Geo Distance function
Syntax | <double> distance (<double> latitude1, <double> longitude1, <double> latitude2, <double> longitude2 ) |
---|
Extension Type | Function |
---|
Description | Gives distance between two geo locations in meters. |
---|
Example | distance(latitude, longitude, prevLatitude, prevLongitude) returns 2322119.848252557
|
---|