Unfortunately, CouchDB does not include geo-spatial indicies, and geoCouch requires a ton of dependancies, and is complicates. ExternalJ is a framework (sort of) to make writing external processes for CouchDB simpler. ExternalJ also comes with several useful applications, including a “geo” application which implements a geo-spatial index on a database. It's only dependency is java 1.5 (ExternalJ will compile against 1.4, but ExternalJ-Geo needs some of the concurrency structures in 1.5). It's fast a lightweight. At the moment, it keeps indicies in memory, but I'll be adding file storage soon.
http://compu.terlicio.us/code/externalj/ To read about it and installation instructions http://svn.murderonvenus.com/externalj/ To get it http://svn.murderonvenus.com/externalj/trunk/README to read more about it Better documentation in the coming days. To give some very general performance numbers, with CouchDB 0.10.x current and ExternalJ 0.10.x.7, I was able to index the entire contents of the FAA's us airport database (about 20,000 entries). The index took about 60 seconds to build and lived in about 800 KBytes of memory (total ExternalJ overhead about 4 MB). Querying the nearest 10 entries to an arbitrary point takes about 40ms the first time and almost 0 after that (query cache). Finding all the points within x miles of an arbitrary point (using a formula "accurate" on the surface of the earth) takes 30-300ms, and will be further optimized with distance calculation caching in the future. It runs fine along with Couch on a 256 MB slicehost.com "slice" (a Xen instance). Also running, nginx proxy and php_cgi. In addition to the Geo applicaiton, I've included a trivial HelloWorld application and a somewhat trivial Say application which can be used as the starting point for your own external process. ExternalJ can also be run from the console, so that you can "see" the interaction with couch, and there are special "$command" commands outlined on the web page to give you some insight into running times and heap size. If you have any questions, please drop me an e-mail or drop a comment on the ExternalJ page. ~ Christopher
