spatial4j
spatial4j copied to clipboard
Optionally tweak geohash encoding to not split extreme longitudes
A geohash grid square becomes increasingly skinny as it gets closer to a pole. When geohashes used as an encoding for shape coverage (e.g. Lucene spatial's Geohash based SpatialPrefixTree), this is a problem because it doesn't scale. We could add a boolean flag to GeohashUtils when it encodes a point such that certain extreme longitudes don't get split in half like they normally would.
https://issues.apache.org/jira/browse/LUCENE-5056 (and see attached pic too)
It seems much of the difficulty here is not so much the impact on the implementation for encoding a point or decoding a geohash; it's the method: getSubGeohashes(String geohash) which is of key importance to lucene-spatial. It has a trivial implementation now but it would become much more complex.
And somewhat related but ideally there would be a "Cell" object that would maintain state, which would make it easier to implement this method. Lucene-spatial has this of course which has me returning to the idea that Lucene-spatial might want to maintain it's own geohash logic integrated prefix-tree that doesn't use Spatial4j GeohashUtils. We'll see; once I get coding a solution, I'll see where that takes me.