As an alternative to GeoCouch, you might consider using geohashes for search, 
e.g. by computing the geohash for each position, store it in the document, 
build a view sorted by geohash and use view queries to read ranges of geohashes 
with specific string prefixes.

Information about geohashes:
http://en.wikipedia.org/wiki/Geohash

Demo website:
http://openlocation.org/geohash/geohash-js/

Some useful libraries to compute them:
http://code.google.com/p/simplelatlng/
https://github.com/davetroy/geohash-js/blob/master/geohash.js

 
Date: Mittwoch, 19. Februar 2014 um 01:24 Uhr
From: "Ben Skarsgård" <[email protected]>
To: [email protected]
Subject: Passing permanent changing arguments to a view?
> 
> [...]
>
> I stored locations (doc) to my couchDB.
>
> e. g.:
> {
> name: "Location A",
> latitude: 52.521156,
> longitude: 13.396886
> }
> 
> Because it's a mobile app, I only want to get docs within a radius of 5km.
> But I really don't know how to query this.
> 
> Is there a possibility to pass some arguments to a view?
> Something like this:
> 
> function(doc) {
> if (doc.longitude > minLong
> && doc.longitude < maxLong
> && doc.latitude > minLat
> && doc.latitude < maxLat)
> emit(doc.name, null);
> };
> 
> Or should every user create and update his own view?

Reply via email to