Loading TOC...

geogml.toGml

geogml.toGml(
   region as cts.region[],
   [gml-namespace as String]
) as Sequence

Summary

Construct GML elements from cts:region values.

Parameters
region Zero or more cts:region values.
gml-namespace A GML namespace URI that indicates the GML version of the output elements. Defaults to GML v3.2 (http://www.opengis.net/gml/3.2).

Example

const geogml = require("/MarkLogic/geospatial/gml");  

geogml.toGml(
  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)
  ])
);

/* Returns a GML 3.2 polygon element similar to the following:
<gml:Polygon gml:id="n9a22cfd1385cc751" srsName="ML:wgs84" 
             xmlns:gml="http://www.opengis.net/gml/3.2">
  <gml:exterior>
    <gml:LinearRing>
      <gml:posList srsDimension="2">5 1 8 1 8 6 5 7 5 1</gml:posList>
    </gml:LinearRing>
  </gml:exterior>
</gml:Polygon>
*/
  

Example

const geogml = require("/MarkLogic/geospatial/gml");  

// Explicitly specifying the GML namespace URI
geogml.toGml(
  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)
  ]), 'http://www.opengis.net/gml'
);

/* Returns a GML polygon element similar to the following:

<gml:Polygon gml:id="nff4985dc42e44817" srsName="ML:wgs84" 
             xmlns:gml="http://www.opengis.net/gml">
  <gml:exterior>
    <gml:LinearRing>
      <gml:posList srsDimension="2">5 1 8 1 8 6 5 7 5 1</gml:posList>
    </gml:LinearRing>
  </gml:exterior>
</gml:Polygon>
*/
  

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