Loading TOC...

geogml:to-gml

geogml:to-gml(
   $region as cts:region*,
   [$gml-namespace as xs:string]
) as element()*

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

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

geogml:to-gml(
  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 GML v3.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

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

(: Explicitly specify the GML namespace URI :)
geogml:to-gml(
  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"
)

==> 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.