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