geometry-api-java icon indicating copy to clipboard operation
geometry-api-java copied to clipboard

Support for serializing/deserializing geometry to geohash?

Open JimBlaney opened this issue 6 years ago • 3 comments

I'm looking to see if implementing Geometry <-> Geohash functionality would be something that would be welcomed for inclusion in this library. I know there are other Java libraries to do Geohashing, but looking for something that explicitly constructs a java.com.esri.core.geometry.Geometry instance. Thanks!

JimBlaney avatar Jan 28 '19 17:01 JimBlaney

@JimBlaney What types of geometry would you convert to and from geohash?

stolstov avatar Jan 28 '19 18:01 stolstov

My particular use case includes:

  • point -> geohash
  • geohash -> envelope
  • geohash -> point (centroid)

JimBlaney avatar Jan 29 '19 11:01 JimBlaney

Preferably this should be a standalone Geohash class. class Geohash: static Envelope2D geohashToEnvelope(String geoHash) - envelope of the geohash cell. static String toGeohash(Point2D pt, int characterLength) - converts a point to the geohash of given length. Other direction of conversion is to use geohashToEnvelope and get the envelope center. static String containingGeohash(Envelope2D envelope) - longest geohash that contains the envelope static String[] coveringGeohash(Envelope2D envelope) - up to four geohashes that completely cover given envelope.

stolstov avatar Aug 06 '19 19:08 stolstov