Skip to content

API Docs - v4.0.16

Geo

distance (Function)

This method gives the distance between two geo locations in meters

Syntax

<DOUBLE> geo:distance(<DOUBLE> location1.latitude, <DOUBLE> location1.longitude, <DOUBLE> location2.latitude, <DOUBLE> location2.longitude)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
location1.latitude latitude value of 1st location DOUBLE No No
location1.longitude longitude value of 1st location DOUBLE No No
location2.latitude latitude value of 2nd location DOUBLE No No
location2.longitude longitude value of 2nd location DOUBLE No No

Examples EXAMPLE 1

geo:distance(latitude, longitude, prevLatitude, prevLongitude)

This will returns the distance in meters

intersects (Function)

This function can be called using two sets of parameters.
 First method will return true if the incoming event geo.json.geometry intersects the given geo.json.geometryFence else false.
 Second method will return true if the location pointed by longitude and latitude intersects the given geo.json.geometryFence else false
 Please refer examples

Syntax

<BOOL> geo:intersects(<DOUBLE> longitude, <DOUBLE> latitude, <STRING> geo.json.geometry, <STRING> geo.json.geometry.fence)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
longitude this will accepts the longitude value of the geo location as a double, This and the latitude value can be given instead of giving geo.json.geometry value DOUBLE No No
latitude this will accepts the latitude value of the geo location as a double. DOUBLE No No
geo.json.geometry this will accepts a json as a string which contains the geometry type and coordinates of a geo geometry. This can be given instead of the longitude and latitude values STRING No No
geo.json.geometry.fence this will accepts a json as a string which contains the geometry type and coordinates of a geo geometry fence STRING No No

Examples EXAMPLE 1

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 geo.json.geometry intersects geo.json.geometry.fence

EXAMPLE 2

 intersects(0.5. 0.5 , {'type':'Polygon','coordinates':[[[0, 0],[0, 1],[1, 1],[1, 0],[0, 0]]]})

returns true because location pointed by longitude and latitude intersects geo.json.geometry.fence

within (Function)

This function can be call using two sets of parameters.
 This will returns true if the location specified in terms of longitude and latitude is within the geo.json.geometry.fence.
 Or returns true if the geo.json.geometry is within the geo.json.geometry.fence.Returns false otherwise

Syntax

<BOOL> geo:within(<DOUBLE> longitude, <DOUBLE> latitude, <STRING> geo.json.geometry, <STRING> geo.json.geometry.fence)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
longitude longitude value of the geolocation DOUBLE No No
latitude latitude value of the geo location DOUBLE No No
geo.json.geometry this will accepts a json as a string which contains the geometry type and coordinates of a geo geometry. This can be given instead of longitude and latitude values STRING No No
geo.json.geometry.fence this will accepts a json as a string which contains the geometry type and coordinates of a geo geometry fence STRING No No

Examples EXAMPLE 1

within(0.5, 0.5, {'type':'Polygon','coordinates':[[[0,0],[0,2],[1,2],[1,0],[0,0]]]} )

This will returns true since given longitude and latitude values are within the geo.json.geometry.fence

EXAMPLE 2

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 since geo.json.geometry is within the geo.json.geometry.fence.

withinDistance (Function)

This function can be call using two sets of parameters.
 First method will returns true if the location specified in terms of longitude and latitude is within distance of the geo.json.geometry.fence. Returns false otherwise.
 Second method will return true if the area given by geo.json.geometry is within distance of the geo.json.geometry.fence.
 please refer examples

Syntax

<BOOL> geo:withinDistance(<DOUBLE> longitude, <DOUBLE> latitude, <STRING> geo.json.geometry, <STRING> geo.json.geometry.fence)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
longitude longitude value of the geolocation DOUBLE No No
latitude latitude value of the geo location DOUBLE No No
geo.json.geometry this will accepts a json as a string which contains the geometry type and coordinates of a geo geometry. This can be given instead of longitude and latitude values STRING No No
geo.json.geometry.fence this will accepts a json as a string which contains the geometry type and coordinates of a geo geometry fence STRING No No

Examples EXAMPLE 1

withindistance( 0.5 , 0.5, {'type':'Polygon','coordinates':[[[0, 0],[0, 1],[1, 1],[1, 0],[0, 0]]]}, 110574.61087757687)

This will returns true because the location specified in terms of longitude and latitude is within the distance of the geo.json.geometry.fence.

EXAMPLE 2

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)

This will returns true because geo.json.geometry is within the distance of geo.json.geometry.fence.

closestPoints (Stream Function)

This will return the closest geo point to the geo.json.geometry.fence

Syntax

geo:closestPoints(<DOUBLE> longitude, <DOUBLE> latitude, <STRING> geo.json.geometry.fence)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
longitude longitude value of the location DOUBLE No No
latitude latitude value of the location DOUBLE No No
geo.json.geometry.fence string value of the json object which contains the details of the geo geometry fence. STRING No No
Extra Return Attributes
Name Description Possible Types
closestPointOf1From2Latitude closest point's latitude to the fence from the location DOUBLE
closestPointOf1From2Longitude closest point's longitude to the fence from the location DOUBLE
closestPointOf2From1Latitude closest point's latitude to the location from the fence DOUBLE
closestPointOf2From1Longitude closest point's longitude to the location from the fence DOUBLE

Examples EXAMPLE 1

closestPoints(0.5,0.5,"{'type':'Polygon','coordinates':[[[0,0],[0,2],[1,2],[1,0],[0,0]]]}")

this will return 0.5, 0.5, 0.5, 0.5

locationApproximate (Stream Function)

Geo Location Approximation compute the average location of the locationRecorder using the collection iBeacons which the location recorder resides.

Syntax

geo:locationApproximate(<STRING> location.recorder, <DOUBLE> latitude, <DOUBLE> longitude, <STRING> sensor.proximity, <STRING> sensor.uuid, <DOUBLE> sensor.weight, <LONG> timestamp)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
location.recorder unique id of the object or item STRING No No
latitude latitude value of the iBeacon DOUBLE No No
longitude longitude value of the iBeacon DOUBLE No No
sensor.proximity proximity which will be given by the iBeacon (eg: ENTER, RANGE, EXIT) STRING No No
sensor.uuid unique id of the iBeacon STRING No No
sensor.weight weight of the iBeacon which influence the averaging of the location (eg: approximate distance from the iBeacon DOUBLE No No
timestamp timestamp of the log which will be used to remove iBeacon from one's collection when there is no new log for 5 minutes LONG No No

Examples EXAMPLE 1

geoLocationApproximate("person1", 6.876657, 79.897648, "ENTER", "uuid1", 20.0d, 1452583935L)

this will return 6.876657000000001 as the approximated location

crosses (Stream Processor)

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 geo.json.geometry.fence. Returns false when the object crosses out of the location specified in geo.json.geometry.fence.
 Or Returns true when the object (i.e. geo.json.geometry) crosses the specified geographic location (i.e. geo.json.geometry.fence). Returns false when the object crosses out of geo.json.geometry.fence.

Syntax

geo:crosses(<STRING> id, <DOUBLE> longitude, <DOUBLE> latitude, <STRING> geo.json.geometry, <STRING> geo.json.geometry.fence)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
id location id STRING No No
longitude this will accepts the longitude value of the geo location as a double, This and the latitude value can be given instead of giving geo.json.geometry value DOUBLE No No
latitude this will accepts the latitude value of the geo location as a double. DOUBLE No No
geo.json.geometry this will accepts a json as a string which contains the geometry type and coordinates of a geo geometry.This can be given instead of the longitude and latitude values STRING No No
geo.json.geometry.fence this will accepts a json as a string which contains the geometry type and coordinates of a geo geometry fence STRING No No
Extra Return Attributes
Name Description Possible Types
isCrossed This will return a boolean value BOOL

Examples EXAMPLE 1

crosses(km-4354, -0.5, 0.5, {'type':'Polygon','coordinates':[[[0, 0],[2, 0],[2, 1],[0, 1],[0, 0]]]} )

This will return true since the specified location crosses the geo.json.geometry.fence

proximity (Stream Processor)

This will 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.

Syntax

geo:proximity(<STRING> id, <DOUBLE> longitude, <DOUBLE> latitude, <STRING> geo.json.geometry.fence, <DOUBLE> radius)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
id id of the object STRING No No
longitude longitude value of the location DOUBLE No No
latitude latitude value of the location DOUBLE No No
geo.json.geometry.fence string value of the json object which contains the details of the geo geometry fence. STRING No No
radius specific radius as a double value DOUBLE No No
Extra Return Attributes
Name Description Possible Types
isWithinProximity This will return a boolean value BOOL

Examples EXAMPLE 1

proximity(1, 0, 0, 110574.61087757687)

This will return true since given longitude and latitude is within the radius

stationary (Stream Processor)

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.

Syntax

geo:stationary(<STRING> id, <DOUBLE> longitude, <DOUBLE> latitude, <STRING> geo.json.geometry.fence, <DOUBLE> radius)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
id object id which is defined in terms of longitude and latitude STRING No No
longitude longitude of the location as a double DOUBLE No No
latitude latitude of the location as a double DOUBLE No No
geo.json.geometry.fence string value of the json object which contains the details of the geo geometry fence. This is STRING Yes No
radius specific radius as a double value DOUBLE No No
Extra Return Attributes
Name Description Possible Types
isStationary This will return a boolean value BOOL

Examples EXAMPLE 1

stationary(km-4354,0,0, 110574.61087757687)

returns true