Loading TOC...

MarkLogic Server 11.0 Product Documentation
geo:interior-point

geo:interior-point(
   $region as cts:region,
   [$options as xs:string*]
) as cts:point?

Summary

This function returns a point that is guaranteed to be inside the bounds of the given region. For a given region and set of options, the point returned should be stable from one call to the next.

Parameters
region A cts region.
options

Options include:

"coordinate-system=value"
Use the given coordinate system. Valid values are wgs84, wgs84/double, etrs89, etrs89/double, raw and raw/double. Defaults to the governing coordinating system.
"precision=value"
Use the coordinate system at the given precision. Allowed values: float and double. Defaults to the precision of the governing coordinate system.
"units=value"
Measure distance, radii of circles, and tolerance in the specified units. Allowed values: miles (default), km, feet, meters.
"tolerance=distance"
Tolerance is the largest allowable variation in geometry calculations. If the distance between two points is less than tolerance, then the two points are considered equal. For the raw coordinate system, use the units of the coordinates. For geographic coordinate systems, use the units specified by the units option.

Usage Notes

Under extreme circumstances a point may be returned that may in fact not be inside a polygon, due to the limits of floating point arithmetic. Double precision should be used to get more accurate results.

The value of the precision option takes precedence over that implied by the governing coordinate system name, including the value of the coordinate-system option. For example, if the governing coordinate system is "wgs84/double" and the precision option is "float", then the operation uses single precision.

See Also

Example

geo:interior-point(cts:polygon("10,10 20,20 50,50 10,10"))

 => a cts:point with the coordinates 30,25

Example

xquery version "1.0-ml";
import module namespace op = 'http://marklogic.com/optic' 
           at 'MarkLogic/optic.xqy';
import module namespace ogeo = 'http://marklogic.com/optic/expression/geo' 
           at 'MarkLogic/optic/optic-geo.xqy';

(: Optic example using the Value Processing Function ogeo:interior-point() :)
let $plan:= op:from-view('buildings', 'builds')
             =>op:bind(op:as('result',ogeo:interior-point(op:col('poly'))))
             =>op:select(('result', op:col('geoid')))
             =>op:order-by('result')

return $plan=>op:result()

(:
==>
rows representing an interior point of the 'poly' column
:)

Example

xquery version "1.0-ml";
  xdmp:sql("select ST_PointOnSurface(poly) from builds order by geoid limit 20")
(:
==>
rows representing an interior point of the 'poly' column
:)

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