Small library for building geospatial layers in Go

Hello,

I’ve just started a small library in Go for sharing common tools that may help with building geospatial layers based on Geohash (integer) encoding.

It is probably a bit early for making this public, with one reason being that it expects the tuple layer in Go to handle uint64 encoding somewhat similarly to the Java library, though I am curious if anyone has feedback from their experience or helpful tools to add, so I am sharing it now anyway. :sunglasses:

The first method implements a radius search by skipping physically-distant ranges and including nearby ranges that are numerically distant. It is fairly simple, though it might make building efficient geospatial indices easier for someone getting started with FoundationDB or Z-order curves.

For example, getting a list of key ranges to iterate through and pass to Transaction.GetRange:

keyRanges := fdbgeo.RadialRange(fdbgeo.RadialRangeParams{
  Subspace:  dir,
  Radius:    32.18688,
  Latitude:  37.334722,
  Longitude: -122.008889,
})

A haversine function is necessary for most use cases after parsing the results. It seemed specific to how the results are parsed, so it is left to the user.

If someone would like to improve or add-to this library, feel free to submit a PR or open an issue. :vulcan_salute:

Edit: I have decided since posting this to decouple any logic that is not specific to FoundationDB from this package and provide convenience wrappers for use with FoundationDB using this package.

2 Likes