Cray Graph Engine (CGE) Haversine Functions

Information about using CGE's Haversine functions.

CGE supports the haversinemeters() and haversinemiles() functions to enable support for spatially aware applications. These functions are based on the Haversine formula, which is an equation that calculates the great-circle distance between two points on a sphere from the longitudes and latitudes of the two points. For more information, visit http://en.wikipedia.org/wiki/Haversine_formula.

The syntax of CGE Haversine functions is shown below:
  • afq:haversinemeters(latStart, longStart, latEnd, longEnd)
  • afq:haversinemiles(latStart, longStart, latEnd, longEnd)
Note: The haversinemeters() and haversinemiles() functions are case sensitive.

Inputs

Both the CGE haversinemeters() and haversinemiles() functions accept the following inputs in xsd:decimal, xsd:double and xsd:float formats:
  • atStart – The starting position of the latitude (dimensions of the values in degrees)
  • longStart – The starting position of the longitude (dimensions of the values in degrees)
  • latEnd – The ending position of the latitude (dimensions of the values in degrees)
  • longEnd – The ending position of the latitude (dimensions of the values in degrees)
Acceptable latitude values range from -90 to 90, whereas acceptable longitude values range from -180 degrees to 180 degrees.  
Note: Important: The functions will return an empty value if:   
  • Invalid position coordinates are provided
  • Empty input values are provided
  • Insufficient parameters are provided.

Output

The haversinemeters() function returns the distance between two points in meters, whereas the haversinemiles() function returns the distance between two points in miles.

Function Prefix

The prefix to use when using CGE Haversine functions in queries is:

PREFIX afq: <http://jena.hpl.hp.com/ARQ/function#>