Loading TOC...

MarkLogic 12 EA 1 Product Documentation
geo.regionApproximate

geo.regionApproximate(
   region as cts.region,
   threshold as Number,
   [options as String[]]
) as cts.region

Summary

This function returns a simplified approximation of the region, using the Douglas-Peucker algorithm.

Parameters
region A cts region.
threshold How close the approximation should be, in the units specified by the units option.
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. Tolerance must be smaller than the value of the threshold parameter.

Usage Notes

Tolerance must be smaller than the threshold.

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.regionApproximate(
  cts.polygon([
    cts.point(0,0),
    cts.point(4,0),
    cts.point(2,10),
    cts.point(2,14),
    cts.point(2,11),
    cts.point(0,4),
    cts.point(0,0)]), 400, ['tolerance=1'])

// => A cts.region with the coordinates 0,0 2,14 2,11 0,0

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