geo.interiorPoint( region as cts.region, [options as String[]] ) as cts.point?
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.
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.
geo.interiorPoint(cts.polygon('10,10 20,20 50,50 10,10')) // => a cts.point with the coordinates 30,25
// Optic example using the Value Processing Function op.geo.interiorPoint() const op = require('/MarkLogic/optic'); const result=op.fromView('buildings', 'builds') .bindAs('result',op.geo.interiorPoint(op.col('poly'))) .select(['result', op.col('geoid')]) .orderBy('result') .result() result // ==> // rows representing an interior point of the 'poly' column
'use strict'; xdmp.sql("select ST_PointOnSurface(poly) from builds order by geoid limit 20") // ==> // rows representing an interior point of the 'poly' column
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.