<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/geo.shortestDistance.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>geo.shortestDistance</api:function-name><api:suggest>geo.shortestdistance</api:suggest><api:suggest>geo</api:suggest><api:suggest>shortestdistance</api:suggest><api:function-link mode="xquery" fullname="geo:shortest-distance">/apidoc/8.0/geo:shortest-distance.xml</api:function-link><api:function mode="javascript" name="shortestDistance" type="builtin" lib="geo" category="SearchBuiltins" subcategory="Geospatial Operations" hidden="false" bucket="MarkLogic Built-In Functions" prefix="geo" namespace="http://marklogic.com/geospatial" fullname="geo.shortestDistance"><api:summary>
  Returns the great circle distance (in miles) between a point and an
  region.  The region is defined by a <code xmlns="http://www.w3.org/1999/xhtml">cts:region</code>.
</api:summary><api:params><api:param name="p1" type="cts:point"><api:param-description>
  The first point.
  </api:param-description><api:param-name>p1</api:param-name><api:param-type>cts.point</api:param-type></api:param><api:param name="region" type="cts:region+"><api:param-description>
  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 <code xmlns="http://www.w3.org/1999/xhtml">cts:shortest-distance</code> returns 0. If the point
  specified in the first parameter in not in the region specified in this
  parameter, then  <code xmlns="http://www.w3.org/1999/xhtml">cts:shortest-distance</code> returns the
  shortest distance to the boundary of the region.
  </api:param-description><api:param-name>region</api:param-name><api:param-type>cts.region[]</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
  Options for the operation. The default is ().
  <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
  <blockquote xmlns="http://www.w3.org/1999/xhtml">
     <dl>
     <dt>"coordinate-system=wgs84"</dt>
     <dd>Use the WGS84 coordinate system.</dd>
     <dt>"units=miles"</dt>
     <dd>Distance is measured in miles.</dd>
     </dl>
   </blockquote>
  </api:param-description><api:param-name>options</api:param-name><api:param-type>String[]</api:param-type></api:param></api:params><api:return>Number</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
geo.shortestDistance(
  cts.point(37.494965, -122.267654),
  cts.linestring([cts.point(40.720921, -74.008878),
                  cts.point(38.950224, -77.019714)]);
)
=&gt; 2431.82739813132, which is the shortest distance (in miles)
   between San Carlos, CA and an arc between New York City and
   Washington DC.
</pre></api:example></api:function></api:function-page>