MarkLogic 9 Product Documentation
geojson:to-geojson

geojson:to-geojson(
   $regions as cts:region*
) as object-node()*

Summary

Convert cts:region values into GeoJSON object nodes.

Parameters
regions Zero or more cts:region values to convert to GeoJSON.

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.

See Also

Example

  xquery version "1.0-ml";
  import module namespace geojson = "http://marklogic.com/geospatial/geojson"
         at "/MarkLogic/geospatial/geojson.xqy";

  geojson:to-geojson(
    cts:polygon((
      cts:point(5.0,1.0), cts:point(8.0,1.0),
      cts:point(8.0,6.0), cts:point(5.0,7.0)
    ))
  )

==> A JSON object node representing a GeoJSON polygon with the given
    coordinates.
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy