
geogml:polygon( $polygon-or-points as element()+ ) as cts:polygon
Create a cts:polygon value from a sequence of GML
Point elements or a GML Polygon element.
(: create a cts:polygon from a sequence of GML Points :)
xquery version "1.0-ml";
import module namespace geogml = "http://marklogic.com/geospatial/gml"
at "/MarkLogic/geospatial/gml.xqy";
declare namespace gml="http://www.opengis.net/gml/3.2";
geogml:polygon((
<gml:Point>
<gml:pos>12.5 -127.24</gml:pos>
</gml:Point>,
<gml:Point>
<gml:pos>15.25 -127.8</gml:pos>
</gml:Point>,
<gml:Point>
<gml:pos>13.45 -126.1</gml:pos>
</gml:Point>,
<gml:Point>
<gml:pos>12.5 -127.24</gml:pos>
</gml:Point>
))
(: Create a cts:polygon from a GML Polygon :)
xquery version "1.0-ml";
import module namespace geogml = "http://marklogic.com/geospatial/gml"
at "/MarkLogic/geospatial/gml.xqy";
declare namespace gml="http://www.opengis.net/gml/3.2";
geogml:polygon(
<gml:Polygon>
<gml:exterior><gml:LinearRing>
<gml:pos>12.5 -127.24</gml:pos>
<gml:pos>15.25 -127.8</gml:pos>
<gml:pos>13.45 -126.1</gml:pos>
<gml:pos>12.5 -127.24</gml:pos>
</gml:LinearRing></gml:exterior>
</gml:Polygon>
)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.