Loading TOC...

MarkLogic 12 EA 2 Product Documentation
geo:bearing

geo:bearing(
   $p1 as cts:point,
   $p2 as cts:point,
   [$options as xs:string*]
) as xs:double

Summary

Returns the true bearing in radians of the path from the first point to the second. An error is raised if the two points are the same.

Parameters
p1 The first point.
p2 The second point.
options Options for the operation. The default is ().

Options include:

"coordinate-system=string"
Use the given coordinate system. Valid values are:
wgs84
The WGS84 coordinate system with degrees as the angular unit.
wgs84/radians
The WGS84 coordinate system with radians as the angular unit.
wgs84/double
The WGS84 coordinate system at double precision with degrees as the angular unit.
wgs84/radians/double
The WGS84 coordinate system at double precision with radians as the angular unit.
etrs89
The ETRS89 coordinate system.
etrs89/double
The ETRS89 coordinate system at double precision.
raw
The raw (unmapped) coordinate system.
raw/double
The raw coordinate system at double precision.
"precision=value"
Use the coordinate system at the given precision. Allowed values: float and double.
"units=value"
Unit of measure of the tolerance value. Valid values are miles (default), km, feet, meters.
"tolerance=distance"
Tolerance is the largest allowable variation in geometry calculations. If the distance between two points is less than tolerance, then the two points are considered equal. For the raw coordinate system, use the units of the coordinates. For geographic coordinate systems, use the units specified by the units option.

Usage Notes

The value of the precision option takes precedence over that implied by the governing coordinate system name, including the value of the coordinate-system option. For example, if the governing coordinate system is "wgs84/double" and the precision option is "float", then the operation uses single precision.

Tolerance reflects how accurate you believe the data is. Computing a bearing between two points that are effectively equal within the limits of data accuracy is likely to produce useless results: The tolerance parameter can be used to force an error in this situation. Effective tolerance may be limited by the limits of precision.

See Also

Example

let $sf := cts:point(37, -122)
let $ny := cts:point(40, -73)
return
geo:bearing($sf, $ny)

=> 1.22127859526251

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.