Search code examples
javageospatialgeohashinggeomesa

Geomesa-utils: How to choose ResolutionRange


Using geomesa-utils to get geohashes, I shall pass as parameter ResolutionRange instance. See https://github.com/locationtech/geomesa/blob/4ef7662cd695008cfd6ed4ee4b4cb0bc45b886cc/geomesa-utils/src/main/scala/org/locationtech/geomesa/utils/geohash/GeohashUtils.scala#L60

I need to get 6 letters geohashes. After some tests, I found that the maxBitsResolution should be nb letters x 5 . So I set it to 30.

What is the logic inside? How should I choose the minBitsResolution and numBitsIncrement?

Thx.


Solution

  • If you want only 6-letter geohashes from GeohashUtils.decomposeGeometry, then you would pass in ResolutionRange(30, 30, 0).

    The decomposeGeometry method can return variable size geohashes. For example, decomposing the whole cartesian plane could be returned as 2 1-bit geohashes, 4 2-bit geohashes, etc. For irregular polygons, the interior of the polygon can generally be represented by a coarser geohash with no loss of precision, while finer geohashes can be used for the edge areas to minimize the extra, non-overlapping area. This is easier to understand in this visualization in the GeoMesa documentation.

    The ResolutionRange argument defines the acceptable size of output geohashes, providing the minimum geohash resolution, the maximum resolution, and the step increment when going from one resolution to the next.