Permalink
Browse files

* renamed CouchApp to 'geo' * renamed GeoJSON document property to '…

…doc.geometry'
  • Loading branch information...
1 parent 1b6ae36 commit dce255f8a280a6fb681170b4e7da52ee5784b71f @berb berb committed Jan 9, 2011
View
@@ -10,17 +10,17 @@ The folder `couchapp/` is a CouchApp that provides useful spatial functions. Fol
* 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
+ * The CouchApp is then available at http://*yourcouch*/*db*/_design/geo
-The document structure is used consistently within all views and examples, assuming that location information is provided in `doc.geo` containing a GeoJSON struct.
+The document structure is used consistently within all views and examples, assuming that location information is provided in `doc.geometry` containing a GeoJSON struct.
If your document structure differs, don't forget to adapt the (spatial) views.
Example:
{
"_id": "c0c048ad2770bb836a10f164cc0a3fc0",
"_rev": "1-e2d2130da93ca435965d6d3efca22380",
- "geo": {
+ "geometry": {
"type": "Point",
"coordinates": [
48.417,
@@ -34,11 +34,11 @@ Example:
#### points.js
-A spatial view that additionally emits the original GeoJSON value (doc.geo)
+A spatial view that additionally emits the original GeoJSON value (doc.geometry)
Example:
- $ curl 'http://localhost:5984/gc-utils/_design/gc-utils/_spatial/points?bbox=80,88,90,90'
+ $ curl 'http://localhost:5984/gc-utils/_design/geo/_spatial/points?bbox=80,88,90,90'
{
"update_seq":203,
"rows":[
@@ -52,7 +52,7 @@ Example:
],
"value":{
"id":"c0c048ad2770bb836a10f164cc08a3e5",
- "geo":{
+ "geometry":{
"type":"Point",
"coordinates":[
81.0876957164146,
@@ -70,7 +70,7 @@ A spatial view that emits both GeoJSON and the full document (as value).
Example:
- $ curl 'http://localhost:5984/gc-utils/_design/gc-utils/_spatial/pointsFull?bbox=80,88,90,90'
+ $ curl 'http://localhost:5984/gc-utils/_design/geo/_spatial/pointsFull?bbox=80,88,90,90'
{
"update_seq":203,
"rows":[
@@ -85,7 +85,7 @@ Example:
"value":{
"_id":"c0c048ad2770bb836a10f164cc08a3e5",
"_rev":"1-0e087449742a73b5ce0df1415b1af3f3",
- "geo":{
+ "geometry":{
"type":"Point",
"coordinates":[
81.0876957164146,
@@ -103,7 +103,7 @@ A spatial view that only emits GeoJSON and no additional value.
Example:
- $ curl 'http://localhost:5984/gc-utils/_design/gc-utils/_spatial/pointsOnly?bbox=80,88,90,90'
+ $ curl 'http://localhost:5984/gc-utils/_design/geo/_spatial/pointsOnly?bbox=80,88,90,90'
{
"update_seq":203,
"rows":[
@@ -134,7 +134,7 @@ This list functions generates a simple KML feed
Examples:
-Open a tool capable of handling KML feeds and import your query link: `http://localhost:5984/gc-utils/_design/gc-utils/_spatiallist/kml/points?bbox=0,0,45,45`
+Open a tool capable of handling KML feeds and import your query link: `http://localhost:5984/gc-utils/_design/geo/_spatiallist/kml/points?bbox=0,0,45,45`
#### geojson.js
@@ -152,7 +152,7 @@ Examples:
}
- $curl -X GET 'http://localhost:5984/gc-utils/_design/gc-utils/_spatiallist/geojson/points?bbox=80,88,90,90'
+ $curl -X GET 'http://localhost:5984/gc-utils/_design/geo/_spatiallist/geojson/points?bbox=80,88,90,90'
{
"type":"FeatureCollection",
"features":[
View
@@ -1 +1 @@
-_design/gc-utils
+_design/geo
@@ -16,7 +16,7 @@ function(head, req) {
send('{"type": "FeatureCollection", "features":[');
while (row = getRow()) {
- out = '{"type": "Feature", "geometry": ' + JSON.stringify(row.value.geo);
+ out = '{"type": "Feature", "geometry": ' + JSON.stringify(row.value.geometry);
delete row.value.geo;
out += ', "properties": ' + JSON.stringify(row.value) + '}';
@@ -12,10 +12,10 @@ function(head, req) {
send('<Document>\n');
send('<name>GeoCouch Result - KML Feed</name>\n');
while (row = getRow()) {
- if(row.value.geo){
+ if(row.value.geometry){
send('\t<Placemark>');
send('<name>'+row.id+'</name>');
- send('<Point><coordinates>'+row.value.geo.coordinates[0]+','+row.value.geo.coordinates[1]+',0</coordinates></Point>');
+ send('<Point><coordinates>'+row.value.geometry.coordinates[0]+','+row.value.geometry.coordinates[1]+',0</coordinates></Point>');
send('</Placemark>\n');
}
}
@@ -2,10 +2,10 @@
* A simple spatial view that emits GeoJSON plus the original GeoJSON value and document id.
*/
function(doc){
- if(doc.geo){
- emit(doc.geo, {
+ if(doc.geometry){
+ emit(doc.geometry, {
id: doc._id,
- geo: doc.geo
+ geometry: doc.geometry
});
}
-}
+}
@@ -2,7 +2,7 @@
* A simple spatial view that emits the GeoJSON plus the complete documents.
*/
function(doc){
- if(doc.geo){
- emit(doc.geo, doc);
+ if(doc.geometry){
+ emit(doc.geometry, doc);
}
-}
+}
@@ -2,7 +2,7 @@
* A simple spatial view that emits only the GeoJSON object further values.
*/
function(doc){
- if(doc.geo){
- emit(doc.geo, null);
+ if(doc.geometry){
+ emit(doc.geometry, null);
}
-}
+}
@@ -51,7 +51,7 @@ for (var i = 0; i < documentCount; i++) {
var client = clients[ptr++ % httpClientPoolSize];
var entity = {
- "geo" : {
+ "geometry" : {
"type" : "Point",
"coordinates": [randomArbitrary(bbox[0],bbox[2]),randomArbitrary(bbox[1],bbox[3])]
}

0 comments on commit dce255f

Please sign in to comment.