Loading TOC...

geogml.polygon

geogml.polygon(
   $polygon-or-points as Node[]
) as cts.polygon

Summary

Create a cts.polygon value from a sequence of GML Point elements or a GML Polygon element.

Parameters
$polygon-or-points A sequence of Point elements representing the vertices of the polygon or a Polygon element. Note that if it is a Polygon element, the return from this function represents the exterior polygon.

Example

// Create a cts:polygon from a GML Polygon
const geogml = require("/MarkLogic/geospatial/gml");  

xdmp.describe(fn.head(
  geogml.polygon(
    fn.head(xdmp.unquote(  
    "<gml:Polygon xmlns:gml='http://www.opengis.net/gml/3.2'>" + 
      "<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>"
    )).root
)));
 

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