Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updating readme and license

  • Loading branch information...
commit 3a0bd2eb0c2475efe12dac1e2a1cf18cef9f77c6 1 parent 4cbe541
Max Ogden maxogden authored
Showing with 42 additions and 19 deletions.
  1. +2 −1  .gitignore
  2. +1 −1  LICENSE
  3. +39 −17
3  .gitignore
@@ -1 +1,2 @@
@@ -1,6 +1,6 @@
# This software is licensed under the MIT License.
-# Copyright (c) 2011 Volker Mische (, Benjamin Erb (
+# Copyright (c) 2011 Volker Mische (, Benjamin Erb (, Max Ogden (
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -1,39 +1,61 @@
# Helper Functions for GeoCouch
-This is a CouchApp providing helpul spatial functions and a set of helper scripts for GeoCouch.
+This is a [CouchApp]( providing spatial functions and a set of helper scripts for GeoCouch.
-## CouchApp
+# Quick install (without cloning this repo)
-The folder `couchapp/` is a CouchApp that provides useful spatial functions. Follow these steps for deployment to your GeoCouch:
+* If you don't already have one, make a database on your couch: <code>curl -X PUT http://YOURCOUCH/DBNAME</code>
+* Replicate the geocouch utils from my public couch to your database: <code>curl -X POST http://YOURCOUCH/\_replicate -d '{"source":"","target":"http://YOURCOUCH/DBNAME", "doc\_ids":["_design/geo"]}'</code>
- * Install the couchapp command line utility ()
- * Clone this repository. Don't forget to do so recursively if you need vendor submodules.
- * Change directory into `couchapp/` and execute: "couchapp init"
- * Push to your GeoCouch: couchapp push http://*yourcouch*/*db*
- * The CouchApp is then available at http://*yourcouch*/*db*/_design/gc-utils
+# In-depth install
-### lists
+If you don't have a database, you'll have to create a new database to store your data. You can do this from http://YOURCOUCH/_utils or with <code>curl</code>:
+<code>curl -X PUT http://YOURCOUCH/DBNAME</code>
+When you store geo data in GeoCouch, you have to store them in the document under the key called <code>geometry</code>:
+ // add a document with a valid geometry into your database
+ $ curl -X PUT http://localhost:5984/DBNAME/myfeature -d '{"type":"Feature", "color":"orange" ,"geometry":{"type":"Point","coordinates":[11.395,48.949444]}}'
+ {"ok":true,"id":"myfeature","rev":"1-2eeb1e5eee6c8e7507b671aa7d5b0654"}
+You can either replicate the couchapp from my public couch []( (quickest option) or, if you want to hack on the source code first, you'll need to install the [CouchApp command line utility]( and check out this repo.
+If you want to hack on the code (aka build it yourself), once you have the couchapp utility working, <code>git clone</code> this repo and go into this folder and execute <code>couchapp init</code>. To upload these utils into your couch just run <code>couchapp push http://YOURCOUCH/DATABASENAME</code>. Otherwise see the Quick install section above.
+When you push these utils into your couch it will enhance your database with the magical geo sprinkles contained in this repo and teach your database how to do awesome things with geo data. At this point you can use the following commands:
+### [List Functions](
#### geojson.js
This function outputs a GeoJSON FeatureCollection (compatible with
-OpenLayers). The geometry is stored in the `geometry` property, all
+OpenLayers and other mapping libraries). The geometry is stored in the `geometry` property, all
other properties in the `properties` property.
- $ curl -X PUT -d '{"type":"Feature", "color":"orange" ,"geometry":{"type":"Point","coordinates":[11.395,48.949444]}}' 'http://localhost:5984/gc-utils/myfeature'
- {"ok":true,"id":"myfeature","rev":"1-2eeb1e5eee6c8e7507b671aa7d5b0654"}
- $ curl -X GET 'http://localhost:5984/vmxch/_design/gc-utils/_list/geojson/all'
+ $ curl -X GET http://localhost:5984/somedb/_design/geo/_list/geojson/all
{"type": "FeatureCollection", "features":[{"type": "Feature", "geometry": {"type":"Point","coordinates":[11.395,48.949444]}, "properties": {"_id":"myfeature","_rev":"1-2eeb1e5eee6c8e7507b671aa7d5b0654","type":"Feature","color":"orange"}}
+#### radius.js
+This will take the centroid of the bbox parameter and a supplied radius parameter in meters and filter the rectangularly shaped bounding box result set by circular radius.
+**WARNING** This only works with on points, not lines or polygons yet
+ $ curl -X GET http://localhost:5984/mydb/_design/geo/_spatiallist/radius/points?bbox=-122.677,45.523,-122.675,45.524&radius=50
+ {"rows":[{"id":"ef512bfdc9b17e9827f7275dd07d59c0","geometry":{"coordinates":[-122.676634,45.523667],"type":"Point"}},
+ {"id":"ef512bfdc9b17e9827f7275dd07f4316","geometry":{"coordinates":[-122.676649,45.523966],"type":"Point"}},
+ {"id":"ef512bfdc9b17e9827f7275dd08985a9","geometry":{"coordinates":[-122.676652,45.524034],"type":"Point"}}]};
-## Helper Scripts
+### Helper Scripts
In the folder `misc` you can find helpful scripts or snippets for GeoCouch.
-### geocouch-filler.js
+#### geocouch-filler.js
This node.js script can be handy for generating test data. It creates random documents within given value ranges. The script expects the following parameters:
Please sign in to comment.
Something went wrong with that request. Please try again.