Skip to content

geos.GEOSHilbertCode ⇒ number

Calculate the Hilbert code of the centroid of a geometry relative to an extent. This allows sorting geometries in a deterministic way, such that similar Hilbert codes are likely to be near each other in two-dimensional space. The caller must ensure that the geometry is contained within the extent.

Kind: global property of geos
Returns: number - 1 on success, 0 on exception.

ParamTypeDescription
geomGEOSGeometryInput geometry, must be non-empty
extentGEOSGeometryExtent within which to calculate the Hilbert code for geom
levelnumberThe level of precision of the Hilbert curve, up to 16
codeNumberPointerPointer to be filled in with Hilbert code result

geos.GEOSHilbertCode_r ⇒ number

Calculate the Hilbert code of the centroid of a geometry relative to an extent. This allows sorting geometries in a deterministic way, such that similar Hilbert codes are likely to be near each other in two-dimensional space. The caller must ensure that the geometry is contained within the extent.

Kind: global property of geos
Returns: number - 1 on success, 0 on exception.

ParamTypeDescription
handleGEOSContextHandle_t-
geomGEOSGeometryInput geometry, must be non-empty
extentGEOSGeometryExtent within which to calculate the Hilbert code for geom
levelnumberThe level of precision of the Hilbert curve, up to 16
codeNumberPointerPointer to be filled in with Hilbert code result