Loading TOC...

MarkLogic 10 Product Documentation
geo.geospatialQueryFromNodes

geo.geospatialQueryFromNodes(
   regions as Node[],
   [options as String[]],
   [weight as Number?]
) 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

// Assume you previously inserted a document into the database, as follows:
declareUpdate();
xdmp.documentInsert('example.json',
  { type: 'Feature',  
    geometry: {    
      type: 'Point',    
      coordinates: [125.6, 8.1]
     },
     properties: { name: 'Test' }
  });

// Then the following search matches the above document.
const geo = require('/MarkLogic/geospatial/geospatial');
cts.search(
  geo.geospatialQueryFromNodes(
    { "type": "Polygon",
      "coordinates": [
        [ [35, 1], [131, 1], [131, 120], [35, 120], [35, 1] ]
      ]
    }
));

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.