1

I'm trying to write a simple go application that interfaces with DynamoDB to store points as a geohash.

Essentially I'm trying to replicate what the Java geo lib for DynamoDB does, but with Go.

I'm using https://github.com/mmcloughlin/geohash to encode the point:

geohash.EncodeInt(47.61121, -122.31846) // produces 6379143490183141059

The Geo Library for Amazon DynamoDB blog post mentions that a negative 64-bit geohash encoding of a point is possible. Specifically they mention -6093522776912656819.

I can't find a lat/lng combination, that when run through geohash.EncodeInt() produces a negative integer value.

What lat/lng combination will encode to a negative integer?

rynop
  • 50,086
  • 26
  • 101
  • 112
  • My hunch is the go port of the S2 lib (https://godoc.org/github.com/golang/geo/s2#CellID) can't return a negative int, because it returns `uint64`. The Java port of S2 returns a `float`, which can produce negative. If I use go S2 port, I can just assume positive integers always. AMIRITE? – rynop Jul 09 '19 at 06:32
  • 1
    I couldn't find any! Geohash Wikipedia entry mentions some edge cases but none of them will produce negative values. Your hunch is most probably correct. – LuisTavares Jul 11 '19 at 20:03

0 Answers0