Loading TOC...

geo:polygon-to-linestring

geo:polygon-to-linestring(
   $region as cts:region
) as cts:linestring*

Summary

Construct a linestring from the vertices of a polygon, or construct a sequence of linestrings from the outer and inner polygons of a complex polygon.

Parameters
$region A cts:polygon or cts:complex-polygon from which to generate a linestring or linestrings.

Usage Notes

The vertex that closes the loop is excluded from the result linestring(s).

An error is thrown if any of the input values is not a polygon or complex polygon.

See Also

Example

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

geo:polygon-to-linestring(
  cts:polygon((
    cts:point(1,1),cts:point(2,2),
    cts:point(3,3),cts:point(1,1)
  ))
)

==> A cts:linestring similar to the following:
    cts:linestring("LINESTRING(1 1,2 2,3 3)")
  

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