Loading TOC...


   $p1 as cts:point,
   $region as cts:region+,
   [$options as xs:string*]
) as xs:double


Returns the great circle distance (in units) between a point and a region. The region is defined by a cts:region.

p1 The first point.
region A region such as a circle, box, polygon, linestring, or complex-polygon. For compatibility with previous versions, a sequence of points is interpreted as a sequence of arcs (defined pairwise) and the distance returned is the shortest distance to one of those points. If the first parameter is a point within the region specified in this parameter, then this function returns 0. If the point specified in the first parameter in not in the region specified in this parameter, then this function returns the shortest distance to the boundary of the region.
options Options for the operation. The default is ().

Options include:

Use the given coordinate system. Valid values are:
The WGS84 coordinate system.
The WGS84 coordinate system at double precision.
The ETRS89 coordinate system.
The ETRS89 coordinate system at double precision.
The raw (unmapped) coordinate system.
The raw coordinate system at double precision.
Measure distance and the radii of circles in the specified units. Allowed values: miles (default), km, feet, meters.
Use the coordinate system at the given precision. Allowed values: float and double.

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.

See Also


  cts:point(37.494965, -122.267654),
  cts:linestring((cts:point(40.720921, -74.008878),
                  cts:point(38.950224, -77.019714)))

=> 2431.82739813132, which is the shortest distance (in miles)
   between San Carlos, CA and an arc between New York City and
   Washington DC.

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