|
|
geo:geospatial-query(
|
|
$regions as cts:region*,
|
|
[$options as xs:string*],
|
|
[$weight as xs:double?]
|
| ) as cts:query |
|
 |
Summary:
Returns a cts:query matching points within given regions.
|
Parameters:
$regions
:
One or more geographic boxes, circles, polygons, or points.
Where multiple boxes, circles, polygons, or points are specified,
the query matches if any box, circle, polygon, or point matches.
|
$options
(optional):
Options to this query. The default is ().
Options include:
- "coordinate-system=wgs84"
- Use the WGS84 coordinate system.
- "boundaries-included"
- Points on boxes' and circles' boundaries are counted as matching. This is the default.
- "boundaries-excluded"
- Points on boxes' and circles' 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.
|
$weight
(optional):
A weight for this query. The default is 1.0.
|
|
Usage Notes:
The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system. Southern latitudes and Western
longitudes take negative values. Longitudes will be wrapped to the range
(-180,+180) and latitudes will be clipped to the range (-90,+90).
If the northern boundary of a box is south of the southern boundary, no
points will match. However, longitudes wrap around the globe, so that if
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
Special handling occurs at the poles, as all longitudes exist at latitudes
+90 and -90.
The query constructed will examine points in all the supported geospatial
markup vocabularies. If not all these vocabularies will be in use, it may
be more efficient to use the query constructors for just the vocabulary or
vocabularies that are in actual use.
|
Example:
xquery version "1.0-ml";
(: create a document with test data :)
declare namespace gml= "http://www.opengis.net/gml";
declare namespace georss= "http://www.georss.org/georss";
xdmp:document-insert("/points.xml",
<root xmlns:geo="http://marklogic.com/geospatial">
<item><gml:Point><gml:pos>10.5 30.0</gml:pos></gml:Point></item>
<item><georss:point>15.35 35.34</georss:point></item>
<item><Dot Latitude="5.11" Longitude="40.55"/></item>
</root> );
xquery version "1.0-ml";
import module namespace geo = "http://marklogic.com/geospatial"
at "/MarkLogic/geospatial/geospatial.xqy";
declare namespace gml= "http://www.opengis.net/gml";
declare namespace georss= "http://www.georss.org/georss";
declare namespace kml= "http://earth.google.com/kml/2.0";
cts:search(doc("/points.xml")//item,
geo:geospatial-query(
geo:box(
<gml:Envelope>
<gml:lowerCorner>10.0 35.0</gml:lowerCorner>
<gml:upperCorner>20.0 40.0</gml:upperCorner>
</gml:Envelope>)
))
(:
returns the following node:
<item><georss:point>15.35 35.34</georss:point></item>
:)
,
cts:search(doc("/points.xml")//item,
geo:geospatial-query(geo:box(
<kml:LatLongBox>
<kml:north>20.0</kml:north>
<kml:south>10.0</kml:south>
<kml:east>35.0</kml:east>
<kml:west>40.0</kml:west>
</kml:LatLongBox>
)))
(:
returns the following nodes (wrapping around the Earth):
<item><gml:Point><gml:pos>10.5 30.0</gml:pos></gml:Point></item>
:)
,
cts:search(doc("/points.xml")//item,
geo:geospatial-query(
cts:box(10.0, 35.0, 20.0, 40.0)))
(:
returns the following node:
<item><georss:point>15.35 35.34</georss:point></item>
:)
|
|
|
|
geo:geospatial-query-from-elements(
|
|
$regions as element()*,
|
|
[$options as xs:string*],
|
|
[$weight as xs:double?]
|
| ) as cts:query |
|
 |
Summary:
Returns a cts:query matching points within given regions.
|
Parameters:
$regions
:
One or more geographic boxes, circles, polygons, or points, represented
by elements in one of the supported vocabularies.
Where multiple boxes, circles, polygons, or points are specified,
the query matches if any box, circle, polygon, or point matches.
|
$options
(optional):
Options to this query. The default is ().
Options include:
- "coordinate-system=wgs84"
- Use the WGS84 coordinate system.
- "boundaries-included"
- Points on boxes' and circles' boundaries are counted as matching. This is the default.
- "boundaries-excluded"
- Points on boxes' and circles' 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.
|
$weight
(optional):
A weight for this query. The default is 1.0.
|
|
Usage Notes:
The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system. Southern latitudes and Western
longitudes take negative values. Longitudes will be wrapped to the range
(-180,+180) and latitudes will be clipped to the range (-90,+90).
If the northern boundary of a box is south of the southern boundary, no
points will match. However, longitudes wrap around the globe, so that if
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
Special handling occurs at the poles, as all longitudes exist at latitudes
+90 and -90.
The query constructed will examine points in all the supported geospatial
markup vocabularies. If not all these vocabularies will be in use, it may
be more efficient to use the query constructors for just the vocabulary or
vocabularies that are in actual use.
This function will take into account interior polygons, if any, and properly
construct the query to account for them.
|
Example:
xquery version "1.0-ml";
(: create a document with test data :)
declare namespace gml= "http://www.opengis.net/gml";
declare namespace georss= "http://www.georss.org/georss";
xdmp:document-insert("/points.xml",
<root xmlns:geo="http://marklogic.com/geospatial">
<item><gml:Point><gml:pos>10.5 30.0</gml:pos></gml:Point></item>
<item><georss:point>15.35 35.34</georss:point></item>
<item><Dot Latitude="5.11" Longitude="40.55"/></item>
</root> );
xquery version "1.0-ml";
import module namespace geo = "http://marklogic.com/geospatial"
at "/MarkLogic/geospatial/geospatial.xqy";
declare namespace gml= "http://www.opengis.net/gml";
declare namespace georss= "http://www.georss.org/georss";
declare namespace kml= "http://earth.google.com/kml/2.0";
cts:search(doc("/points.xml")//item,
geo:geospatial-query-from-elements(
<gml:Envelope>
<gml:lowerCorner>10.0 35.0</gml:lowerCorner>
<gml:upperCorner>20.0 40.0</gml:upperCorner>
</gml:Envelope>
) )
(:
returns the following node:
<item><georss:point>15.35 35.34</georss:point></item>
:)
,
cts:search(doc("/points.xml")//item,
geo:geospatial-query-from-elements(
<kml:LatLongBox>
<kml:north>20.0</kml:north>
<kml:south>10.0</kml:south>
<kml:east>35.0</kml:east>
<kml:west>40.0</kml:west>
</kml:LatLongBox>
))
(:
returns the following nodes (wrapping around the Earth):
<item><georss:point>15.35 35.34</georss:point></item>
<item><gml:Point><gml:pos>10.5 30.0</gml:pos></gml:Point></item>
:)
|
|
|
|
georss:geospatial-query(
|
|
$regions as cts:region*,
|
|
[$options as xs:string*],
|
|
[$weight as xs:double?]
|
| ) as cts:query |
|
 |
Summary:
Returns a cts:query matching points within given regions.
|
Parameters:
$regions
:
One or more geographic boxes, circles, or points. Where multiple boxes,
circles, or points are specified, the query matches if any box, circle, or
point matches.
|
$options
(optional):
Options to this query. The default is ().
Options include:
- "coordinate-system=wgs84"
- Use the WGS84 coordinate system.
- "boundaries-included"
- Points on boxes' and circles' boundaries are counted as matching. This is the default.
- "boundaries-excluded"
- Points on boxes' and circles' 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.
|
$weight
(optional):
A weight for this query. The default is 1.0.
|
|
Usage Notes:
The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system. Southern latitudes and Western
longitudes take negative values. Longitudes will be wrapped to the range
(-180,+180) and latitudes will be clipped to the range (-90,+90).
If the northern boundary of a box is south of the southern boundary, no
points will match. However, longitudes wrap around the globe, so that if
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
Special handling occurs at the poles, as all longitudes exist at latitudes
+90 and -90.
|
Example:
xquery version "1.0-ml";
(: create a document with test data :)
xdmp:document-insert("/points.xml",
<root xmlns:georss="http://www.georss.org/georss">
<item><georss:point>10.5 30.0</georss:point></item>
<item><georss:point>15.35 35.34</georss:point></item>
<item><georss:point>5.11 40.55</georss:point></item>
</root> );
xquery version "1.0-ml";
import module namespace georss = "http://www.georss.org/georss"
at "/MarkLogic/geospatial/georss.xqy";
cts:search(doc("/points.xml")//item,
georss:geospatial-query(cts:box(10.0, 35.0, 20.0, 40.0)))
(:
returns the following node:
<item><georss:point>15.35 35.34</georss:point></item>
:)
|
|
|
|
gml:geospatial-query(
|
|
$regions as cts:region*,
|
|
[$options as xs:string*],
|
|
[$weight as xs:double?]
|
| ) as cts:query |
|
 |
Summary:
Returns a cts:query matching points within given regions.
|
Parameters:
$regions
:
One or more geographic boxes, circles, polygons, or points.
Where multiple boxes,
circles, polygons, or points are specified, the query matches if any
box, circle, polygon, or
point matches.
|
$options
(optional):
Options to this query. The default is ().
Options include:
- "coordinate-system=wgs84"
- Use the WGS84 coordinate system.
- "boundaries-included"
- Points on boxes' and circles' boundaries are counted as matching. This is the default.
- "boundaries-excluded"
- Points on boxes' and circles' 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.
|
$weight
(optional):
A weight for this query. The default is 1.0.
|
|
Usage Notes:
The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system. Southern latitudes and Western
longitudes take negative values. Longitudes will be wrapped to the range
(-180,+180) and latitudes will be clipped to the range (-90,+90).
If the northern boundary of a box is south of the southern boundary, no
points will match. However, longitudes wrap around the globe, so that if
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
Special handling occurs at the poles, as all longitudes exist at latitudes
+90 and -90.
|
Example:
xquery version "1.0-ml";
(: create a document with test data :)
xdmp:document-insert("/points.xml",
<root xmlns:gml="http://www.opengis.net/gml">
<item><gml:Point><gml:pos>10.5 30.0</gml:pos></gml:Point></item>
<item><gml:Point><gml:pos>15.35 35.34</gml:pos></gml:Point></item>
<item><gml:Point><gml:pos>5.11 40.55</gml:pos></gml:Point></item>
</root> );
xquery version "1.0-ml";
import module namespace gml = "http://www.opengis.net/gml"
at "/MarkLogic/geospatial/gml.xqy";
cts:search(doc("/points.xml")//item,
gml:geospatial-query(
gml:box(
<gml:Envelope>
<gml:lowerCorner>10.0 35.0</gml:lowerCorner>
<gml:upperCorner>20.0 40.0</gml:upperCorner>
</gml:Envelope>) ))
(:
returns the following node:
<item><gml:Point><gml:pos>15.35 35.34</gml:pos></gml:Point></item>
:)
,
cts:search(doc("/points.xml")//item,
gml:geospatial-query(gml:box(
<gml:Envelope>
<gml:lowerCorner>10.0 40.0</gml:lowerCorner>
<gml:upperCorner>20.0 35.0</gml:upperCorner>
</gml:Envelope>
)))
(:
returns the following nodes (wrapping around the Earth):
<item><gml:Point><gml:pos>10.5 30.0</gml:pos></gml:Point></item>
:)
|
|
|
|
gml:geospatial-query-from-elements(
|
|
$regions as element()*,
|
|
[$options as xs:string*],
|
|
[$weight as xs:double?]
|
| ) as cts:query |
|
 |
Summary:
Returns a cts:query matching points within given
regions.
|
Parameters:
$regions
:
One or more geographic boxes, circles, polygons, or points, represented
as GML elements.
Where multiple boxes,
circles, polygons, or points are specified, the query matches if any
box, circle, polygon, or
point matches.
|
$options
(optional):
Options to this query. The default is ().
Options include:
- "coordinate-system=wgs84"
- Use the WGS84 coordinate system.
- "boundaries-included"
- Points on boxes' and circles' boundaries are counted as matching. This is the default.
- "boundaries-excluded"
- Points on boxes' and circles' 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.
|
$weight
(optional):
A weight for this query. The default is 1.0.
|
|
Usage Notes:
The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system. Southern latitudes and Western
longitudes take negative values. Longitudes will be wrapped to the range
(-180,+180) and latitudes will be clipped to the range (-90,+90).
If the northern boundary of a box is south of the southern boundary, no
points will match. However, longitudes wrap around the globe, so that if
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
Special handling occurs at the poles, as all longitudes exist at latitudes
+90 and -90.
This function will take into account interior polygons, if any, and properly
construct the query to account for them.
|
Example:
xquery version "1.0-ml";
(: create a document with test data :)
xdmp:document-insert("/points.xml",
<root xmlns:gml="http://www.opengis.net/gml">
<item><gml:Point><gml:pos>10.5 30.0</gml:pos></gml:Point></item>
<item><gml:Point><gml:pos>15.35 35.34</gml:pos></gml:Point></item>
<item><gml:Point><gml:pos>5.11 40.55</gml:pos></gml:Point></item>
</root> );
xquery version "1.0-ml";
import module namespace gml = "http://www.opengis.net/gml"
at "/MarkLogic/geospatial/gml.xqy";
cts:search(doc("/points.xml")//item,
gml:geospatial-query-from-elements(
<gml:Envelope>
<gml:lowerCorner>10.0 35.0</gml:lowerCorner>
<gml:upperCorner>20.0 40.0</gml:upperCorner>
</gml:Envelope>) )
(:
returns the following node:
<item><gml:Point><gml:pos>15.35 35.34</gml:pos></gml:Point></item>
:)
,
cts:search(doc("/points.xml")//item,
gml:geospatial-query-from-elements(
<gml:Envelope>
<gml:lowerCorner>10.0 40.0</gml:lowerCorner>
<gml:upperCorner>20.0 35.0</gml:upperCorner>
</gml:Envelope>) )
(:
returns the following nodes (wrapping around the Earth):
<item><gml:Point><gml:pos>10.5 30.0</gml:pos></gml:Point></item>
:)
|
|
|
|
kml:geospatial-query(
|
|
$regions as cts:region*,
|
|
[$options as xs:string*],
|
|
[$weight as xs:double?]
|
| ) as cts:query |
|
 |
Summary:
Returns a cts:query matching points within given regions.
|
Parameters:
$regions
:
One or more geographic boxes, circles, polygons, or points. Where multiple
boxes, circles, polygons, or points are specified, the query matches if
any box, circle, polygon, or
point matches.
|
$options
(optional):
Options to this query. The default is ().
Options include:
- "coordinate-system=wgs84"
- Use the WGS84 coordinate system.
- "boundaries-included"
- Points on boxes' and circles' boundaries are counted as matching. This is the default.
- "boundaries-excluded"
- Points on boxes' and circles' 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.
|
$weight
(optional):
A weight for this query. The default is 1.0.
|
|
Usage Notes:
The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system. Southern latitudes and Western
longitudes take negative values. Longitudes will be wrapped to the range
(-180,+180) and latitudes will be clipped to the range (-90,+90).
If the northern boundary of a box is south of the southern boundary, no
points will match. However, longitudes wrap around the globe, so that if
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
Special handling occurs at the poles, as all longitudes exist at latitudes
+90 and -90.
|
Example:
xquery version "1.0-ml";
(: create a document with test data :)
xdmp:document-insert("/points.xml",
<root xmlns:kml="http://earth.google.com/kml/2.0">
<item><kml:Point><kml:coordinates>30.0,10.5</kml:coordinates></kml:Point></item>
<item><kml:Point><kml:coordinates>35.34,15.35</kml:coordinates></kml:Point></item>
<item><kml:Point><kml:coordinates>40.55,5.11</kml:coordinates></kml:Point></item>
</root> );
xquery version "1.0-ml";
import module namespace kml = "http://earth.google.com/kml/2.0"
at "/MarkLogic/geospatial/kml.xqy";
cts:search(doc("/points.xml")//item,
kml:geospatial-query(
kml:box(
<kml:LatLongBox>
<kml:north>20.0</kml:north>
<kml:south>10.0</kml:south>
<kml:east>40.0</kml:east>
<kml:west>35.0</kml:west>
</kml:LatLongBox>) ))
(:
returns the following node:
<item><kml:Point><kml:coordinates>35.34,15.35</kml:coordinates></kml:Point></item>
:)
,
cts:search(doc("/points.xml")//item,
kml:geospatial-query(kml:box(
<kml:LatLongBox>
<kml:north>20.0</kml:north>
<kml:south>10.0</kml:south>
<kml:east>35.0</kml:east>
<kml:west>40.0</kml:west>
</kml:LatLongBox>) ))
(:
returns the following nodes (wrapping around the Earth):
<item><kml:Point><kml:coordinates>30.0,10.5</kml:coordinates></kml:Point></item>
:)
|
|
|
|
kml:geospatial-query-from-elements(
|
|
$regions as element()*,
|
|
[$options as xs:string*],
|
|
[$weight as xs:double?]
|
| ) as cts:query |
|
 |
Summary:
Returns a cts:query matching points within given regions.
|
Parameters:
$regions
:
One or more geographic boxes, circles, polygons, or points, represented
as KML elements. Where multiple
boxes, circles, polygons, or points are specified, the query matches if
any box, circle, polygon, or point matches.
|
$options
(optional):
Options to this query. The default is ().
Options include:
- "coordinate-system=wgs84"
- Use the WGS84 coordinate system.
- "boundaries-included"
- Points on boxes' and circles' boundaries are counted as matching. This is the default.
- "boundaries-excluded"
- Points on boxes' and circles' 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.
|
$weight
(optional):
A weight for this query. The default is 1.0.
|
|
Usage Notes:
The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system. Southern latitudes and Western
longitudes take negative values. Longitudes will be wrapped to the range
(-180,+180) and latitudes will be clipped to the range (-90,+90).
If the northern boundary of a box is south of the southern boundary, no
points will match. However, longitudes wrap around the globe, so that if
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
Special handling occurs at the poles, as all longitudes exist at latitudes
+90 and -90.
This function will take into account interior polygons, if any, and properly
construct the query to account for them.
|
Example:
xquery version "1.0-ml";
(: create a document with test data :)
xdmp:document-insert("/points.xml",
<root xmlns:kml="http://earth.google.com/kml/2.0">
<item><kml:Point><kml:coordinates>30.0,10.5</kml:coordinates></kml:Point></item>
<item><kml:Point><kml:coordinates>35.34,15.35</kml:coordinates></kml:Point></item>
<item><kml:Point><kml:coordinates>40.55,5.11</kml:coordinates></kml:Point></item>
</root> );
xquery version "1.0-ml";
import module namespace kml = "http://earth.google.com/kml/2.0"
at "/MarkLogic/geospatial/kml.xqy";
cts:search(doc("/points.xml")//item,
kml:geospatial-query-from-elements(
<kml:LatLongBox>
<kml:north>20.0</kml:north>
<kml:south>10.0</kml:south>
<kml:east>40.0</kml:east>
<kml:west>35.0</kml:west>
</kml:LatLongBox>) )
(:
returns the following node:
<item><kml:Point><kml:coordinates>35.34,15.35</kml:coordinates></kml:Point></item>
:)
,
cts:search(doc("/points.xml")//item,
kml:geospatial-query-from-elements(
<kml:LatLongBox>
<kml:north>20.0</kml:north>
<kml:south>10.0</kml:south>
<kml:east>35.0</kml:east>
<kml:west>40.0</kml:west>
</kml:LatLongBox>) )
(:
returns the following nodes (wrapping around the Earth):
<item><kml:Point><kml:coordinates>30.0,10.5</kml:coordinates></kml:Point></item>
:)
|
|
|
|
mcgm:geospatial-query(
|
|
$regions as cts:region*,
|
|
[$options as xs:string*],
|
|
[$weight as xs:double?]
|
| ) as cts:query |
|
 |
Summary:
Returns a cts:query matching points within given regions.
|
Parameters:
$regions
:
One or more geographic boxes, circles, polygons, or points. Where multiple
boxes, circles, polygons, or points are specified, the query matches if
any box, circle, polygon, or
point matches.
|
$options
(optional):
Options to this query. The default is ().
Options include:
- "coordinate-system=wgs84"
- Use the WGS84 coordinate system.
- "boundaries-included"
- Points on boxes' and circles' boundaries are counted as matching. This is the default.
- "boundaries-excluded"
- Points on boxes' and circles' 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.
|
$weight
(optional):
A weight for this query. The default is 1.0.
|
|
Usage Notes:
The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system. Southern latitudes and Western
longitudes take negative values. Longitudes will be wrapped to the range
(-180,+180) and latitudes will be clipped to the range (-90,+90).
If the northern boundary of a box is south of the southern boundary, no
points will match. However, longitudes wrap around the globe, so that if
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
Special handling occurs at the poles, as all longitudes exist at latitudes
+90 and -90.
|
Example:
xquery version "1.0-ml";
(: create a document with test data :)
xdmp:document-insert("/points.xml",
<root xmlns:mcgm="http://marklogic.com/geospatial/mcgm">
<item><Dot Latitude="10.5" Longitude="30.0"/></item>
<item><Dot Latitude="15.35" Longitude="35.34"/></item>
<item><Dot Latitude="5.11" Longitude="40.55"/></item>
</root> );
xquery version "1.0-ml";
import module namespace mcgm = "http://marklogic.com/geospatial/mcgm"
at "/MarkLogic/geospatial/mcgm.xqy";
cts:search(doc("/points.xml")//item,
mcgm:geospatial-query(
cts:box(10.0, 35.0, 20.0, 40.0)))
(:
returns the following node:
<item><Dot Latitude="15.35" Longitude="35.34"/></item>
:)
,
cts:search(doc("/points.xml")//item,
mcgm:geospatial-query(cts:box(10.0, 40.0, 20.0, 35.0)))
(:
returns the following nodes (wrapping around the Earth):
<item><Dot Latitude="10.5" Longitude="30.0"/></item>
:)
,
cts:search(doc("/points.xml")//item,
mcgm:geospatial-query(
cts:box(10.0, 35.0, 20.0, 40.0)))
(:
returns the following node:
<item><Dot Latitude="15.35" Longitude="35.34"/></item>
:)
|
|
|
|
mcgm:geospatial-query-from-elements(
|
|
$regions as element(Dot)*,
|
|
[$options as xs:string*],
|
|
[$weight as xs:double?]
|
| ) as cts:query |
|
 |
Summary:
Returns a cts:query matching points within given regions.
|
Parameters:
$regions
:
One or more geographic regions, represented by MCGM elements. Where multiple
regions are specified, the query matches if
any region matches.
|
$options
(optional):
Options to this query. The default is ().
Options include:
- "coordinate-system=wgs84"
- Use the WGS84 coordinate system.
- "boundaries-included"
- Points on boxes' and circles' boundaries are counted as matching. This is the default.
- "boundaries-excluded"
- Points on boxes' and circles' 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.
|
$weight
(optional):
A weight for this query. The default is 1.0.
|
|
Usage Notes:
The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system. Southern latitudes and Western
longitudes take negative values. Longitudes will be wrapped to the range
(-180,+180) and latitudes will be clipped to the range (-90,+90).
If the northern boundary of a box is south of the southern boundary, no
points will match. However, longitudes wrap around the globe, so that if
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
Special handling occurs at the poles, as all longitudes exist at latitudes
+90 and -90.
|
|
|