Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A fast geo database with LevelDB, Go and Geohashes (nobugware.com)
50 points by kylequest on Aug 31, 2015 | hide | past | favorite | 7 comments


What this "geo database" lacks is the ability to make actual spatial queries.

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.


I believe it's even more limited to just storing points. One could do a query within a bounding box that does not cross the international date line, and maybe a radius search and that's about it.

Geohashes are good in that it doesn't need any fancy indexing as nearby points are also nearby in the index.


And it is those operations that are actually challenging and in need of optimisation. Questions like "what country is the point in?" can be horribly slow if all you have is one big geometry with millions of points. Bounding box operations can be made fast by just using a normal index.


Hey guys author here, didn't know it was posted on HN.

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.


A few quick code comments:

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) {


It's not actual code but notes for the simplicity of the blog post. Thanks for the advise I didn't know about Truncate.


I was really excited for a new geo database, especially one involving Go. But, this is extremely limited. I could see some uses for it, but how does it do when you are storing hundreds of millions of points (or more) rather than a few million?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: