A fast geo database with LevelDB, Go and Geohashes
blog.nobugware.com
blog.nobugware.com
It is one thing to store and retrieve points, lines and polygons in a database. This is what this stack can do quite well and I suppose for a certain class of geospatial applications, this is the only capability needed. But what you can not do is perform complex operations like: Projection/Reprojection, computing polygon-intersection, computing a convex hull of a set of geometries, compute a centroid, compute an area... (sort of everything that postgis can do).
This is not strictly a "geo database", more a key-value store with the ability to store and retrieve geospatial data.
Geohashes are good in that it doesn't need any fancy indexing as nearby points are also nearby in the index.
You are right about complex geospatial queries, it's not the purpose of this simple storage. But someone sent me a promising lib from Google: https://docs.google.com/presentation/d/1Hl4KapfAENAOf4gv-pSn...
It could be applied to this model to make it handle polygons.
Now().UnixNano() is not guaranteed to be monotonically increasing. I'd be more careful if your keys really do need to be unique.
You can use time.Truncate to get the 10 minute interval.
var t time.Time
t = start
for {
if t.After(stop) {
break
}
/* ... */
t = t.Add(d)
}
Would usually be written: for t := start; !t.After(stop); t = t.Add(d) {