geohash-java Documentation

repository·master·Indexed 21 days ago

https://github.com/kungfoo/geohash-java

A pure Java implementation of Geohashes compatible with geohash.org for standard character-based precision and supporting high-precision 64-bit encoding. Includes support for BoundingBox meridian crossing as of version 1.4.0.

Tokens
448
Snippets
3
Records
4
Agent score
27%

What's inside geohash-java

  1. Understand Geohash precision and error margins

    master

    Geohash precision is determined by the length of the hash. When using character precision (multiples of 5 bits), the hashes are compatible with the reference implementation at geohash.org. The library also supports encoding Geohashes down to the full 64-bit precision of a long.

    geohash length~km error
    1±2500
    2±630
    3±78
    4±20
    5±2.4
    6±0.61
    7±0.076
    8±0.019
  2. Build and test geohash-java using Maven

    master

    The project uses Apache Maven for building and testing. You can use the following standard Maven targets:

    • clean: Cleans the project.
    • compile: Compiles the source code.
    • test: Runs the test suite.
    • package: Packages the compiled classes into a versioned JAR file.
    maven clean compile test package
  3. Construct a BoundingBox for meridian crossing (v1.4.0+)

    master

    Starting with version 1.4.0, BoundingBox supports crossing the 180-degree meridian. This allows for searching and querying areas that span the international date line. To ensure this works correctly, you must provide the latitude and longitude coordinates in a specific order:

    new BoundingBox(south, north, west, east);

    new BoundingBox(south, north, west, east);
  4. Install geohash-java via Maven Central

    master

    The library is available on Maven Central. You can use it in any build system that supports Maven artifacts, such as Maven, Ivy, Gradle, or SBT. To find the latest available versions, search Maven Central for the group ID ch.hsr and artifact ID geohash.

    <!-- Example Maven dependency search criteria -->
    Group ID: ch.hsr
    Artifact ID: geohash