Loading TOC...

MarkLogic 12 EA 1 Product Documentation
geojson.parseGeojson

geojson.parseGeojson(
   geojson as objectNode()[]
) as Sequence

Summary

Convert GeoJSON object nodes into cts:region values.

Parameters
geojson Zero or more JSON object nodes conforming to the GeoJSON specification.

Usage Notes

The GeoJSON Point node includes additional information that is not retained in the cts:point value. In particular, the altitude part of the point value will be dropped. Therefore two GeoJSON points at the same latitude and longitude with different altitude will nevertheless have equal cts:point values.

The returned Sequence contains cts:region values.

See Also

Example

const geojson = require('/MarkLogic/geospatial/geojson.xqy');

geojson.parseGeojson(
  { type: 'Polygon', 
    coordinates: [
      [[1.0, 5.0], [1.0, 8.0], [6.0, 8.0], [7.0, 5.0], [1.0, 5.0]]
  ] }
)

==> A Sequence that contains a cts.polygon equivalent to the input region.
  

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