MarkLogic Server 11.0 Product Documentation
geo.geohashEncode

geo.geohashEncode(
   region as cts.region,
   [geohash-precision as Number?],
   [options as String[]]
) as String

Summary

Compute a set of covering geohashes for the given region, to the given level of precision.

Parameters
region The region to encode.
geohash-precision The desired precision (length of the geohash). The precision should be between 1 and 12. If the precision is less than 1, or unspecified, the default geohash-precision of 6 is used. A geohash-precision greater than 12 is treated as the same as 12. In the worst case (at the equator) a precision of 12 gives resolution of less than a centimeter.
options Options for the operation. The default is ().

Options include:

"coordinate-system=string"
Use the given coordinate system. Valid values are:
wgs84
The WGS84 coordinate system with degrees as the angular unit.
wgs84/radians
The WGS84 coordinate system with radians as the angular unit.
wgs84/double
The WGS84 coordinate system at double precision with degrees as the angular unit.
wgs84/radians/double
The WGS84 coordinate system at double precision with radians as the angular unit.
etrs89
The ETRS89 coordinate system.
etrs89/double
The ETRS89 coordinate system at double precision.
Geohashing is not allowed for non-geodetic coordinate systems. Attempting to use this function with the raw or raw/double coordinate system will result in an XDMP-GEOHASH-COORD error.
"precision=string"
Use the coordinate system at the given precision. Allowed values: float (default) and double.
"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.
geohashes=value
Specify which geohashes to return. Allowed values:
all
Return a complete set of covering hashes for the region (boundary + interior). This is the default behavior.
boundary
Return only geohashes that intersect with the boundary of the region.
interior
Return only geohashes completely contained in the interior of the region.
exterior
Return all geohashes disjoint from the region. That is, all geohashes completely contained in the exterior of the region.

Usage Notes

The default geohash-precision is 6. Care should be taken in the selection of higher geohash-precisions for non-point regions: Converging on a sufficiently precise covering set on polygons with many vertices can be costly.

Geohashes of circles are calculated by approximating the circle by a polygon. This approximation is accurate to within 0.001% of the radius of the circle. If additional precision is required, use geo.circlePolygon to convert the circle before calling this function.

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.geohashEncode(cts.point(1.23354,66.67),12)

=> t2prj0e9gssb
Powered by MarkLogic Server | Terms of Use | Privacy Policy