Loading TOC...

MarkLogic 10 Product Documentation
geogml:polygon

geogml:polygon(
   $polygon-or-points as element()+
) 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 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>
  ))
  

Example

  (: 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 iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.