/jts-discretizer

Primary LanguageJavaApache License 2.0Apache-2.0

jts-discretizer

Build Status Coverage Status Maven Central

This is a tiny Java 8 library able to convert JTS geometries to a set of GeoHashes with arbitrary precision (<12).

A GeoHash-based Mallorca discretization looks like:

alt tag

The precision used is 7 - notice that the GeoHash set is reduced if all children of a certain GeoHash are present.

Maven:

<dependency>
    <groupId>io.github.adrianulbona</groupId>
    <artifactId>jts-discretizer</artifactId>
    <version>0.1.0</version>
</dependency>

Code sample:

final Geometry geometry = ...
final DiscretizerFactory discretizerFactory = new DiscretizerFactoryImpl();
final GeometryDiscretizer<Geometry> discretizer = discretizerFactory.discretizer(geometry);
final Set<GeoHash> geoHashes = discretizer.apply(geometry, 7);