geo.shortestDistance(
$p1 as cts.point,
$region as cts.region[],
[$options as String[]]
) as Number

Summary

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

Parameters

$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 cts:shortest-distance returns 0. If the point
specified in the first parameter in not in the region specified in this
parameter, then cts:shortest-distance returns the
shortest distance to the boundary of the region.

$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.

raw

The raw (unmapped) coordinate system.

"units=miles"

Distance is measured in miles.

Example

geo.shortestDistance(
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.

## Comments