This page was generated
June  25,  2015
8:16  AM
XQuery & XSLT Built-In & Modules Function Reference

Built-In: Search - Geospatial Functions

The geospatial built-in functions are XQuery functions defined to operate on geospatial values.
Function Summary
cts:arc-intersection Returns the point at the intersection of two arcs.
cts:bearing Returns the true bearing in radians of the path from the first point to the second.
cts:bounding-boxes Returns a sequence of boxes that bound the given region.
cts:box Returns a geospatial box value.
cts:box-east Returns a box's eastern boundary.
cts:box-intersects Returns true if the box intersects with a region.
cts:box-north Returns a box's northern boundary.
cts:box-south Returns a box's southern boundary.
cts:box-west Returns a box's western boundary.
cts:circle Returns a geospatial circle value.
cts:circle-center Returns a circle's center point.
cts:circle-intersects Returns true if the circle intersects with a region.
cts:circle-radius Returns a circle's radius.
cts:complex-polygon Returns a geospatial complex polygon value.
cts:complex-polygon-contains Returns true if the complex-polygon contains a region.
cts:complex-polygon-inner Returns a complex polygon's inner polygons.
cts:complex-polygon-intersects Returns true if the complex-polygon intersects with a region.
cts:complex-polygon-outer Returns a complex polygon's outer polygon.
cts:destination Returns the point at the given distance (in miles) along the given bearing (in radians) from the starting point.
cts:distance Returns the distance (in miles) between two points.
cts:linestring Returns a geospatial linestring value.
cts:linestring-vertices Returns a linestring's vertices.
cts:parse-wkt Returns a sequence of geospatial regions parsed from Well-Known Text format.
cts:point Returns a point value.
cts:point-latitude Returns a point's latitude value.
cts:point-longitude Returns a point's longitude value.
cts:polygon Returns a geospatial polygon value.
cts:polygon-contains Returns true if the polygon contains a region.
cts:polygon-intersects Returns true if the polygon intersects with a region.
cts:polygon-vertices Returns a polygon's vertices.
cts:shortest-distance Returns the great circle distance (in miles) between a point and an region.
cts:to-wkt Returns a sequence of strings in Well-Known Text format.
Function Detail
cts:arc-intersection(
$p1 as cts:point,
$p2 as cts:point,
$q1 as cts:point,
$q2 as cts:point,
[$options as xs:string*]
)  as   cts:point
Summary:

Returns the point at the intersection of two arcs. If the arcs do not intersect, or lie on the same great circle, or if either arc covers more than 180 degrees, an error is raised.

Parameters:
$p1 : The starting point of the first arc.
$p2 : The ending point of the first arc.
$q1 : The starting point of the second arc.
$q2 : The ending point of the second arc.
$options (optional): Options for the operation. The default is ().

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.

Example:
let $sf := cts:point(37, -122)
let $ny := cts:point(40, -73)
let $a := cts:point(35,-100)
let $b := cts:point(41,-70)
return
cts:arc-intersection($sf,$ny,$a,$b)

=> 40.458347,-76.203682

cts: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 (optional): Options for the operation. The default is ().

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.

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

=> 1.22100904274442

cts:bounding-boxes(
$region as cts:region,
[$options as xs:string*]
)  as   cts:box*
Summary:

Returns a sequence of boxes that bound the given region.

Parameters:
$region : A geographic region (box, circle, polygon, or point).
$options (optional): Options for the operation. The default is ().

Options include:

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.
"units=miles"
Distance (for circles) is measured in miles.
"box-percent=n"
An integer between 0 and 100 (default is 100) that indicates what percentage of a polygon's bounding box slivers should be returned. Lower numbers give fewer, less accurate boxes; larger numbers give more, more accurate boxes.
"boundaries-included"
Points on boxes', circles', and polygons' boundaries are counted as matching. This is the default.
"boundaries-excluded"
Points on boxes', circles', and polygons' boundaries are not counted as matching.
"boundaries-latitude-excluded"
Points on boxes' latitude boundaries are not counted as matching.
"boundaries-longitude-excluded"
Points on boxes' longitude boundaries are not counted as matching.
"boundaries-south-excluded"
Points on the boxes' southern boundaries are not counted as matching.
"boundaries-west-excluded"
Points on the boxes' western boundaries are not counted as matching.
"boundaries-north-excluded"
Points on the boxes' northern boundaries are not counted as matching.
"boundaries-east-excluded"
Points on the boxes' eastern boundaries are not counted as matching.
"boundaries-circle-excluded"
Points on circles' boundary are not counted as matching.

Example:
cts:bounding-boxes(
  cts:polygon("0,0 20,20 -10,18 5,5 0,0")
)
(: Returns two boxes:
   [-10, 0, 5, 18.976505]
   [5, 4.7157488, 20, 20]
:)
; 
cts:bounding-boxes(
  cts:polygon("0,0 20,20 -10,18 5,5 0,0"), 
  "box-percent=50"
)
(: Returns one box:
   [-10, 0, 20, 20]
:)

cts:box(
$south as xs:float,
$west as xs:float,
$north as xs:float,
$east as xs:float
)  as   cts:box
Summary:

Returns a geospatial box value.

Parameters:
$south : The southern boundary of the box.
$west : The western boundary of the box.
$north : The northern boundary of the box.
$east : The eastern boundary of the box.

Example:
cts:box(45, -122, 78, 30)
=> [45, -122, 78, 30] (as a cts:box)

cts:box-east(
$box as cts:box
)  as   xs:float
Summary:

Returns a box's eastern boundary.

Parameters:
$box : The box.

Example:
cts:box-east(cts:box(45, -122, 78, 30))
=> 30

cts:box-intersects(
$box as cts:box,
$region as cts:region*,
[$options as xs:string*]
)  as   xs:boolean
Summary:

Returns true if the box intersects with a region.

Parameters:
$box : A geographic box.
$region : One or more geographic regions (boxes, circles, polygons, or points). Where multiple regions are specified, return true if any region intersects the box.
$options (optional): Options for the operation. The default is ().

Options include:

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.
"units=miles"
Distance (for circles) is measured in miles.
"boundaries-included"
Points on boxes', circles', and polygons' boundaries are counted as matching. This is the default.
"boundaries-excluded"
Points on boxes', circles', and polygons' boundaries are not counted as matching.
"boundaries-latitude-excluded"
Points on boxes' latitude boundaries are not counted as matching.
"boundaries-longitude-excluded"
Points on boxes' longitude boundaries are not counted as matching.
"boundaries-south-excluded"
Points on the boxes' southern boundaries are not counted as matching.
"boundaries-west-excluded"
Points on the boxes' western boundaries are not counted as matching.
"boundaries-north-excluded"
Points on the boxes' northern boundaries are not counted as matching.
"boundaries-east-excluded"
Points on the boxes' eastern boundaries are not counted as matching.
"boundaries-circle-excluded"
Points on circles' boundary are not counted as matching.

Example:


cts:box-north(
$box as cts:box
)  as   xs:float
Summary:

Returns a box's northern boundary.

Parameters:
$box : The box.

Example:
cts:box-north(cts:box(45, -122, 78, 30))
=> 78

cts:box-south(
$box as cts:box
)  as   xs:float
Summary:

Returns a box's southern boundary.

Parameters:
$box : The box.

Example:
cts:box-south(cts:box(45, -122, 78, 30))
=> 45

cts:box-west(
$box as cts:box
)  as   xs:float
Summary:

Returns a box's western boundary.

Parameters:
$box : The box.

Example:
cts:box-west(cts:box(45, -122, 78, 30))
=> -122

cts:circle(
$radius as xs:float,
$center as cts:point
)  as   cts:circle
Summary:

Returns a geospatial circle value.

Parameters:
$radius : The radius of the circle. The units for the radius is determined at runtime by the cts:query options (miles is currently the only option).
$center : A point representing the center of the circle.

Example:
cts:circle(20, cts:point(37.655983, -122.425525))
=> @20 37.655983,-122.42552 (as a cts:circle)

cts:circle-center(
$circle as cts:circle
)  as   cts:point
Summary:

Returns a circle's center point.

Parameters:
$circle : The circle.

Example:
cts:circle-center(cts:circle(20, cts:point(37.655983, -122.425525)))
=> 37.655983, -122.425525 (as a cts:point)

cts:circle-intersects(
$circle as cts:circle,
$region as cts:region*,
[$options as xs:string*]
)  as   xs:boolean
Summary:

Returns true if the circle intersects with a region.

Parameters:
$circle : A geographic circle.
$region : One or more geographic regions (boxes, circles, polygons, or points). Where multiple regions are specified, return true if any region intersects the target circle.
$options (optional): Options for the operation. The default is ().

Options include:

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.
"units=miles"
Distance (for circles) is measured in miles.
"boundaries-included"
Points on boxes', circles', and polygons' boundaries are counted as matching. This is the default.
"boundaries-excluded"
Points on boxes', circles', and polygons' boundaries are not counted as matching.
"boundaries-latitude-excluded"
Points on boxes' latitude boundaries are not counted as matching.
"boundaries-longitude-excluded"
Points on boxes' longitude boundaries are not counted as matching.
"boundaries-south-excluded"
Points on the boxes' southern boundaries are not counted as matching.
"boundaries-west-excluded"
Points on the boxes' western boundaries are not counted as matching.
"boundaries-north-excluded"
Points on the boxes' northern boundaries are not counted as matching.
"boundaries-east-excluded"
Points on the boxes' eastern boundaries are not counted as matching.
"boundaries-circle-excluded"
Points on circles' boundary are not counted as matching.

Example:


cts:circle-radius(
$circle as cts:circle
)  as   xs:float
Summary:

Returns a circle's radius.

Parameters:
$circle : The circle.

Example:
cts:circle-radius(cts:circle(20, cts:point(37.655983, -122.425525)))
=> 20

cts:complex-polygon(
$outer as cts:polygon,
$inner as cts:polygon*
)  as   cts:complex-polygon
Summary:

Returns a geospatial complex polygon value.

Parameters:
$outer : The outer polygon.
$inner : The innner (hole) polygons.

Example:
cts:complex-polygon(
  cts:polygon("0,0 10,0 10,10 0,10 0,0"),
  cts:polygon("5,0 7,0 7,5 5,5 5,0"))

cts:complex-polygon-contains(
$complex-polygon as cts:complex-polygon,
$region as cts:region*,
[$options as xs:string*]
)  as   xs:boolean
Summary:

Returns true if the complex-polygon contains a region.

Parameters:
$complex-polygon : A geographic complex polygon.
$region : One or more geographic regions (boxes, circles, polygons, or points). Where multiple regions are specified, return true if any region intersects the target polygon.
$options (optional): Options for the operation. The default is ().

Options include:

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.
"units=miles"
Distance (for circles) is measured in miles.
"boundaries-included"
Points on boxes', circles', and complex-polygons' boundaries are counted as matching. This is the default.
"boundaries-excluded"
Points on boxes', circles', and complex-polygons' boundaries are not counted as matching.
"boundaries-latitude-excluded"
Points on boxes' latitude boundaries are not counted as matching.
"boundaries-longitude-excluded"
Points on boxes' longitude boundaries are not counted as matching.
"boundaries-south-excluded"
Points on the boxes' southern boundaries are not counted as matching.
"boundaries-west-excluded"
Points on the boxes' western boundaries are not counted as matching.
"boundaries-north-excluded"
Points on the boxes' northern boundaries are not counted as matching.
"boundaries-east-excluded"
Points on the boxes' eastern boundaries are not counted as matching.
"boundaries-circle-excluded"
Points on circles' boundary are not counted as matching.

Example:
let $cp := 
  cts:complex-polygon(
    cts:polygon("0,0 10,0 10,10 0,10 0,0"),
    cts:polygon("5,0 7,0 7,5 5,5 5,0"))
let $poly :=
  cts:polygon("6,8 6.5,8 6.5,9 6,9 6,8")
return cts:complex-polygon-contains($cp, $poly)
(: returns true :)

cts:complex-polygon-inner(
$complexPolygon as cts:complex-polygon
)  as   cts:polygon*
Summary:

Returns a complex polygon's inner polygons.

Parameters:
$complexPolygon : The complex polygon.

Example:
  let $node := 
    <complexPolygon name="Arapahoe">POLYGON((
      0.396982870000000E+02 -0.104935135000000E+03,
      0.396965870000000E+02 -0.104938635000000E+03,
      0.396965870000000E+02 -0.104938635000000E+03,
      0.397110870000000E+02 -0.104931634000000E+03,
      0.397066870000000E+02 -0.104926934000000E+03,
      0.397012870000000E+02 -0.104932834000000E+03,
      0.396971870000000E+02 -0.104928134000000E+03,
      0.396965870000000E+02 -0.104928134000000E+03,
      0.396965870000000E+02 -0.104928134000000E+03,
      0.396965870000000E+02 -0.104931534000000E+03,
      0.396966870000000E+02 -0.104934335000000E+03,
      0.396966870000000E+02 -0.104934335000000E+03,
      0.396981250000000E+02 -0.104934109000000E+03
      ),

       (
      0.396981250000000E+02 -0.104934109000000E+03,
      0.397001130000000E+02 -0.104931652000000E+03,
      0.397001870000000E+02 -0.104934034000000E+03,
      0.396981250000000E+02 -0.104934109000000E+03
       ))
    </complexPolygon>
    return
    cts:complex-polygon-inner(cts:parse-wkt(fn:data($node)))

cts:complex-polygon-intersects(
$complex-polygon as cts:complex-polygon,
$region as cts:region*,
[$options as xs:string*]
)  as   xs:boolean
Summary:

Returns true if the complex-polygon intersects with a region.

Parameters:
$complex-polygon : A geographic complex-polygon.
$region : One or more geographic regions (boxes, circles, complex-polygons, or points). Where multiple regions are specified, return true if any region intersects the target complex-polygon.
$options (optional): Options for the operation. The default is ().

Options include:

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.
"units=miles"
Distance (for circles) is measured in miles.
"boundaries-included"
Points on boxes', circles', and complex-polygons' boundaries are counted as matching. This is the default.
"boundaries-excluded"
Points on boxes', circles', and complex-polygons' boundaries are not counted as matching.
"boundaries-latitude-excluded"
Points on boxes' latitude boundaries are not counted as matching.
"boundaries-longitude-excluded"
Points on boxes' longitude boundaries are not counted as matching.
"boundaries-south-excluded"
Points on the boxes' southern boundaries are not counted as matching.
"boundaries-west-excluded"
Points on the boxes' western boundaries are not counted as matching.
"boundaries-north-excluded"
Points on the boxes' northern boundaries are not counted as matching.
"boundaries-east-excluded"
Points on the boxes' eastern boundaries are not counted as matching.
"boundaries-circle-excluded"
Points on circles' boundary are not counted as matching.

Example:


cts:complex-polygon-outer(
$complexPolygon as cts:complex-polygon
)  as   cts:polygon?
Summary:

Returns a complex polygon's outer polygon.

Parameters:
$complexPolygon : The complex polygon.

Example:
  let $node := 
    <complexPolygon name="Arapahoe">POLYGON((
      0.396982870000000E+02 -0.104935135000000E+03,
      0.396965870000000E+02 -0.104938635000000E+03,
      0.396965870000000E+02 -0.104938635000000E+03,
      0.397110870000000E+02 -0.104931634000000E+03,
      0.397066870000000E+02 -0.104926934000000E+03,
      0.397012870000000E+02 -0.104932834000000E+03,
      0.396971870000000E+02 -0.104928134000000E+03,
      0.396965870000000E+02 -0.104928134000000E+03,
      0.396965870000000E+02 -0.104928134000000E+03,
      0.396965870000000E+02 -0.104931534000000E+03,
      0.396966870000000E+02 -0.104934335000000E+03,
      0.396966870000000E+02 -0.104934335000000E+03,
      0.396981250000000E+02 -0.104934109000000E+03
      ),
       (
      0.396981250000000E+02 -0.104934109000000E+03,
      0.397001130000000E+02 -0.104931652000000E+03,
      0.397001870000000E+02 -0.104934034000000E+03,
      0.396981250000000E+02 -0.104934109000000E+03
       )
    </complexPolygon>
    return
    cts:complex-polygon-outer(cts:parse-wkt(fn:data($node)))

cts:destination(
$p as cts:point,
$bearing as xs:double,
$distance as xs:double,
[$options as xs:string*]
)  as   cts:point
Summary:

Returns the point at the given distance (in miles) along the given bearing (in radians) from the starting point.

Parameters:
$p : The starting point.
$bearing : The bearing, in radians.
$distance : The distance, in miles.
$options (optional): Options for the operation. The default is ().

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.
"units=miles"
Distance is measured in miles.

Example:
let $sf := cts:point(37, -122)
let $ny := cts:point(40, -73)
return
cts:destination($sf,1.22100904274442,2626.42211914063)

=> 

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

Returns the distance (in miles) between two points.

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

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.
"units=miles"
Distance is measured in miles.

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

=> 2626.42211914063

cts:linestring(
$vertices as cts:point*
)  as   cts:linestring
Summary:

Returns a geospatial linestring value.

Parameters:
$vertices : The waypoints of the linestring, given in order. vertexes.

Example:
  let $points := (cts:point(0.373899653086420E+02, -0.122078578406509E+03),
    cts:point(0.373765400000000E+02, -0.122063772000000E+03),
    cts:point(0.373781400000000E+02, -0.122067972000000E+03),
    cts:point(0.373825650000000E+02, -0.122068365000000E+03),
    cts:point(0.373797400000000E+02, -0.122072172000000E+03),
    cts:point(0.373899400000000E+02, -0.122092573000000E+03) )
  return
  cts:linestring($points)

cts:linestring-vertices(
$linestring as cts:linestring
)  as   cts:point*
Summary:

Returns a linestring's vertices.

Parameters:
$linestring : The linestring.

Example:
  let $linestring := 
    "LINESTRING(
       0.373899653086420E+02 -0.122078578406509E+03,
       0.373765400000000E+02 -0.122063772000000E+03,
       0.373781400000000E+02 -0.122067972000000E+03,
       0.373825650000000E+02 -0.122068365000000E+03,
       0.373797400000000E+02 -0.122072172000000E+03,
       0.373899400000000E+02 -0.122092573000000E+03,
       0.373941400000000E+02 -0.122095573000000E+03,
       0.373966400000000E+02 -0.122094173000000E+03,
       0.373958400000000E+02 -0.122092373000000E+03,
       0.374004400000000E+02 -0.122091273000000E+03)"
    return
    cts:linestring-vertices(cts:linestring($linestring))

cts:parse-wkt(
$wtk as xs:string*
)  as   cts:region*
Summary:

Returns a sequence of geospatial regions parsed from Well-Known Text format.

Parameters:
$wtk : A sequence of strings in Well-Known Text format.

Example:


cts:point(
$latitude as xs:float,
$longitude as xs:float
)  as   cts:point
Summary:

Returns a point value.

Parameters:
$latitude : The latitude of the point.
$longitude : The longitude of the point.

Example:
  cts:point(0.373899653086420E+02, -0.122078578406509E+03)

cts:point-latitude(
$point as cts:point
)  as   xs:float
Summary:

Returns a point's latitude value.

Parameters:
$point : The point.

Example:
  let $point := cts:point(37.270556, -118.672778)
  return
  cts:point-latitude($point)

cts:point-longitude(
$point as cts:point
)  as   xs:float
Summary:

Returns a point's longitude value.

Parameters:
$point : The point.

Example:
  let $point := cts:point(37.270556, -118.672778)
  return
  cts:point-longitude($point)

cts:polygon(
$vertices as cts:point*
)  as   cts:polygon
Summary:

Returns a geospatial polygon value.

Parameters:
$vertices : The vertices of the polygon, given in order. No edge may cover more than 180 degrees of either latitude or longitude. The polygon as a whole may not encompass both poles. These constraints are necessary to ensure an unambiguous interpretation of the polygon. There must be at least three vertices. The first vertex should be identical to the last vertex to close the polygon. vertexes.

Example:
  (: this polygon approximates the 94041 zip code :)
  let $points := (cts:point(0.373899653086420E+02, -0.122078578406509E+03),
    cts:point(0.373765400000000E+02, -0.122063772000000E+03),
    cts:point(0.373781400000000E+02, -0.122067972000000E+03),
    cts:point(0.373825650000000E+02, -0.122068365000000E+03),
    cts:point(0.373797400000000E+02, -0.122072172000000E+03),
    cts:point(0.373899400000000E+02, -0.122092573000000E+03),
    cts:point(0.373941400000000E+02, -0.122095573000000E+03),
    cts:point(0.373966400000000E+02, -0.122094173000000E+03),
    cts:point(0.373958400000000E+02, -0.122092373000000E+03),
    cts:point(0.374004400000000E+02, -0.122091273000000E+03),
    cts:point(0.374004400000000E+02, -0.122091273000000E+03),
    cts:point(0.373873400000000E+02, -0.122057872000000E+03),
    cts:point(0.373873400000000E+02, -0.122057872000000E+03),
    cts:point(0.373854400000000E+02, -0.122052672000000E+03),
    cts:point(0.373833400000000E+02, -0.122053372000000E+03),
    cts:point(0.373819400000000E+02, -0.122057572000000E+03),
    cts:point(0.373775400000000E+02, -0.122060872000000E+03),
    cts:point(0.373765400000000E+02, -0.122063772000000E+03) )
  return
  cts:polygon($points)

cts:polygon-contains(
$polygon as cts:polygon,
$region as cts:region*,
[$options as xs:string*]
)  as   xs:boolean
Summary:

Returns true if the polygon contains a region.

Parameters:
$polygon : A geographic polygon.
$region : One or more geographic regions (boxes, circles, polygons, or points). Where multiple regions are specified, return true if any region contains the target polygon.
$options (optional): Options for the operation. The default is ().

Options include:

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.
"units=miles"
Distance (for circles) is measured in miles.
"boundaries-included"
Points on boxes', circles', and polygons' boundaries are counted as matching. This is the default.
"boundaries-excluded"
Points on boxes', circles', and polygons' boundaries are not counted as matching.
"boundaries-latitude-excluded"
Points on boxes' latitude boundaries are not counted as matching.
"boundaries-longitude-excluded"
Points on boxes' longitude boundaries are not counted as matching.
"boundaries-south-excluded"
Points on the boxes' southern boundaries are not counted as matching.
"boundaries-west-excluded"
Points on the boxes' western boundaries are not counted as matching.
"boundaries-north-excluded"
Points on the boxes' northern boundaries are not counted as matching.
"boundaries-east-excluded"
Points on the boxes' eastern boundaries are not counted as matching.
"boundaries-circle-excluded"
Points on circles' boundary are not counted as matching.

Example:


cts:polygon-intersects(
$polygon as cts:polygon,
$region as cts:region*,
[$options as xs:string*]
)  as   xs:boolean
Summary:

Returns true if the polygon intersects with a region.

Parameters:
$polygon : A geographic polygon.
$region : One or more geographic regions (boxes, circles, polygons, or points). Where multiple regions are specified, return true if any region intersects the target polygon.
$options (optional): Options for the operation. The default is ().

Options include:

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.
"units=miles"
Distance (for circles) is measured in miles.
"boundaries-included"
Points on boxes', circles', and polygons' boundaries are counted as matching. This is the default.
"boundaries-excluded"
Points on boxes', circles', and polygons' boundaries are not counted as matching.
"boundaries-latitude-excluded"
Points on boxes' latitude boundaries are not counted as matching.
"boundaries-longitude-excluded"
Points on boxes' longitude boundaries are not counted as matching.
"boundaries-south-excluded"
Points on the boxes' southern boundaries are not counted as matching.
"boundaries-west-excluded"
Points on the boxes' western boundaries are not counted as matching.
"boundaries-north-excluded"
Points on the boxes' northern boundaries are not counted as matching.
"boundaries-east-excluded"
Points on the boxes' eastern boundaries are not counted as matching.
"boundaries-circle-excluded"
Points on circles' boundary are not counted as matching.

Example:


cts:polygon-vertices(
$polygon as cts:polygon
)  as   cts:point*
Summary:

Returns a polygon's vertices. The first vertex and last vertex will always be the same.

Parameters:
$polygon : The polygon.

Example:
  let $node := 
    <polygon zip="94041">
       0.373899653086420E+02,       -0.122078578406509E+03
       0.373765400000000E+02,       -0.122063772000000E+03
       0.373781400000000E+02,       -0.122067972000000E+03
       0.373825650000000E+02,       -0.122068365000000E+03
       0.373797400000000E+02,       -0.122072172000000E+03
       0.373899400000000E+02,       -0.122092573000000E+03
       0.373941400000000E+02,       -0.122095573000000E+03
       0.373966400000000E+02,       -0.122094173000000E+03
       0.373958400000000E+02,       -0.122092373000000E+03
       0.374004400000000E+02,       -0.122091273000000E+03
       0.374004400000000E+02,       -0.122091273000000E+03
       0.373873400000000E+02,       -0.122057872000000E+03
       0.373873400000000E+02,       -0.122057872000000E+03
       0.373854400000000E+02,       -0.122052672000000E+03
       0.373833400000000E+02,       -0.122053372000000E+03
       0.373819400000000E+02,       -0.122057572000000E+03
       0.373775400000000E+02,       -0.122060872000000E+03
       0.373765400000000E+02,       -0.122063772000000E+03
    </polygon>
    return
    cts:polygon-vertices(cts:polygon(fn:data($node)))

cts:shortest-distance(
$p1 as cts:point,
$region as cts:region+,
[$options as xs:string*]
)  as   xs:double
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 (optional): Options for the operation. The default is ().

Options include:

"coordinate-system=wgs84"
Use the WGS84 coordinate system.
"units=miles"
Distance is measured in miles.

Example:
cts:shortest-distance(
  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.

cts:to-wkt(
$wtk as cts:region*
)  as   xs:string*
Summary:

Returns a sequence of strings in Well-Known Text format.

Parameters:
$wtk : A sequence of geospatial regions.

Example:
xquery version "1.0-ml";

cts:to-wkt(cts:point(36, 71))
=>
POINT(71 36)