Loading TOC...

MarkLogic 9 Product Documentation
geo.parse

geo.parse(
   data as Node[]
) as Sequence

Summary

Convert nodes in one or more of the supported geospatial representations into cts.region values.

Parameters
data Zero or more nodes containing geospatial data in one of the supported formats, such as KML, GML, GeoRSS, or GeoJSON.

Usage Notes

This function examines each input node and delegates to the appropriate format-specific parsing function, such as gml.parseGml or geojson.parseGeojson. The input nodes need not all use the same representation.

The returned Sequence contains cts:region values.

See Also

Example

const geo = require('/MarkLogic/geospatial/geospatial');

const gmlNode =
  gml.point(xdmp.unquote(
    '<gml:Point xmlns:gml="http://www.opengis.net/gml">' +
      '<gml:pos>12.5 -127.24</gml:pos>' +
    '</gml:Point>')
    .next().value.root);
const geoJsonNode =
  { type: 'Polygon', 
    coordinates: [
      [[1.0, 5.0], [1.0, 8.0], [6.0, 8.0], [7.0, 5.0], [1.0, 5.0]]
  ] };
geo.parse([gmlNode, geoJsonNode])

==> A Sequence that contains a cts.point created from a GML node
    and a cts.polygon created from a GeoJSON node, similar to the following.
  

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