geo.circlePolygon( circle as cts.circle, arc-tolerance as Number, [options as String[]] ) as cts.region
Construct a polygon approximating a circle.
When approximating the polygon, if the distance between two points is
less than tolerance
, then they are considered to be the
same point. The arc-tolerance
parameter specifies the
allowable error in the polygon approximation. That is, the resulting
polygon will differ from the provided circle by at most
arc-tolerance
.
The arc-tolerance
parameter value must be greater than
the tolerance, and both arc-tolerance
and tolerance
should be expressed in the same units. For example, if the units
option is set to "km" and you're using a geodetic coordinate system, then
arc-tolerance
and tolerance
(if specified) should
also be in kilometers. The default tolerance is 0.05km (or the equivalent in
other units). Use the tolerance
option to override the default.
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.
It is recommended to use this function for queries, as circle geometry matching
cannot be optimized. Convert circles to polygons before passing them in as
arguments to your queries to get better performance. A common question to ask is
'what points do I have in my database that are within 10 kilometers of point A
?'
This function provides an optimized path for this query.
geo.circlePolygon(cts.circle(7,cts.point(10,20)),4, ["tolerance=1"]); // => A cts.region with the following coordinates: // 10.10185,20 10.050913,20.088997 9.9490623,20.08897 9.8981495,20 // 9.9490623,19.91103 10.050913,19.911001 10.10185,20
// Optic example using the Value Processing Function op.geo.intersects() and geo.circlePolygon() // circlePolygonLit is a polygon representing a 10 kilometer radius around Tucson, Arizona, US const op = require('/MarkLogic/optic'); var circlePolygonLit = geo.circlePolygon(cts.circle(10,cts.point('POINT(-110.97345746274591 32.213051181896034)')),0.01,['tolerance=0.001','units=km']) const result=op.fromView('buildings', 'builds') .where(op.geo.intersects(op.col('poly'),circlePolygonLit)) .select([op.col('name'), op.col('geoid')]) .orderBy('geoid') .result() result; // ==> // rows representing names and geoids where values in the 'poly' column INTERSECT circlePolygonLit
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.