MarkLogic Server 11.0 Product Documentation
geo:geospatial-query-from-nodes

geo:geospatial-query-from-nodes(
   $regions as node()*,
   [$options as xs:string*],
   [$weight as xs:double?]
) as cts:query

Summary

Returns a query matching points within given regions.

Parameters
regions One or more geographic boxes, circles, polygons, linestring or points, represented by either XML elements or JSON object nodes in one of the supported vocabularies. Where multiple boxes, circles, polygons, linestring or points are specified, the query matches if any box, circle, polygon, linestring or point matches.
options 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 A weight for this query. The default is 1.0.

Usage Notes

This function simply redirects to geospatial-query-from-elements (if the input region is an XML element) or to geojson:geospatial-query-from-nodes (if the input region is a JSON object node). See the API docs of those two functions for more details.

See Also

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-nodes(
    <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-nodes(
    <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>
  ))
Powered by MarkLogic Server | Terms of Use | Privacy Policy