Skip to content

Instantly share code, notes, and snippets.

@ingoradatz
Forked from Su-Shee/geocouchosm
Created May 2, 2013 17:13
Show Gist options
  • Save ingoradatz/5503738 to your computer and use it in GitHub Desktop.
Save ingoradatz/5503738 to your computer and use it in GitHub Desktop.
1) have the couchdb source available, geocouch needs some headerfiles
2) get and unpack the appropriate branch of geocouch suited for your couchdb version -
I have 1.3.0 so I got
https://github.com/couchbase/geocouch/tree/couchdb1.3.x
3) set environment:
export COUCH_SRC=/WHEREVER/apache-couchdb-1.3.0/src/couchdb/
4) cd into geocouch-couchdb1.3.x/ sourcetree, run make
5) you now have a couple of erlang "beam" files in your geocouch-couchdb1.3.x/ebin/,
a config file geocouch.ini in geocouch-couchdb1.3.x/etc/couchdb/default.d plus
some tests in geocouch-couchdb1.3.x/share/www/script/test/
a) copy beam files into /usr/lib/couchdb/erlang/lib/geocouch-couchdb1.3.x/ebin
b) copy geocouch.ini to /etc/couchdb/default.d/
c) copy the geocouch tests to /usr/share/couchdb/www/script/test
d) add those tests to /usr/share/couchdb/www/script/couch_tests.js -
I just added them at the end
// geocouch tests
loadTest("spatial.js");
loadTest("list_spatial.js");
loadTest("etags_spatial.js");
loadTest("multiple_spatial_rows.js");
loadTest("spatial_compaction.js");
loadTest("spatial_design_docs.js");
loadTest("spatial_bugfixes.js");
loadTest("spatial_offsets.js");
6) restart couchdb
7) run tests http://127.0.0.1:5984/_utils/couch_tests.html (just click the list above)
8) the documentation in https://github.com/couchbase/geocouch/tree/couchdb1.3.x contains
copy/paste examples, too.
9) install ruby script "shp2geocouch" which will take so called "shapefiles" and shove them
into your new geocouch
gem install shp2geocouch
10) download "shapefiles" from http://downloads.cloudmade.com - start with something SMALL!
11) for starters, just call (see more details here: https://github.com/maxogden/shp2geocouch)
shp2geocouch berlin.shapefiles.zip
12) click
http://localhost:5984/_utils/database.html?berlin
http://localhost:5984/berlin/_design/geo/_rewrite
shp2geocouch tells you the urls after import and BE HAPPY. \o/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment