MarkLogic 9 Product Documentation
geokml:polygon

geokml:polygon(
   $polygon-or-points as element()+
) as cts:polygon

Summary

Create a cts:polygon value from a KML polygon or a sequence of KML Point or Location elements.

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

Example

  xquery version "1.0-ml";
  import module namespace geokml = "http://marklogic.com/geospatial/kml"
         at "/MarkLogic/geospatial/kml.xqy";
  declare namespace kml="http://www.opengis.net/kml/2.2;"

  geokml:polygon((
    <kml:Point>
      <kml:coordinates>-127.24,12.5</kml:coordinates>
    </kml:Point>,
    <kml:Point>
      <kml:coordinates>-127.8,15.25</kml:coordinates>
    </kml:Point>,
    <kml:Point>
      <kml:coordinates>-126.1,13.45</kml:coordinates>
    </kml:Point>,
    <kml:Point>
      <kml:coordinates>-127.24,12.5</kml:coordinates>
    </kml:Point>
  ))
  

Example

  xquery version "1.0-ml";
  import module namespace geokml = "http://marklogic.com/geospatial/kml"
         at "/MarkLogic/geospatial/kml.xqy";
  declare namespace kml="http://www.opengis.net/kml/2.2";

  geokml:polygon(
    <kml:Polygon>
      <kml:outerBoundaryIs><kml:LinearRing>
        <kml:coordinates>-127.24,12.5 -127.8,15.25 -126.1,13.45 -127.24,12.5</kml:coordinates>
      </kml:LinearRing></kml:outerBoundaryIs>
    </kml:Polygon>
  )
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy