incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Seth Falcon <sethfal...@gmail.com>
Subject Re: Retrieving documents that have a latitude and longitude intersection
Date Sun, 14 Jun 2009 19:26:48 GMT
Hi Tim,

On Sun, Jun 14, 2009 at 1:12 AM, Tim Burgess<timburgess@mac.com> wrote:
> Essentially the client-side requests points that fall within a given
> latitude and longitude boundary i.e. a southwest lat, long and a northeast
> lat,long.
> These are my first steps with map/reduce but I've determined how I can use
> startkey and endkey to pull documents within a latitude. I'm
> a bit stumped on a URL query that can do both however.
>
> A simple view such as;
>
> function(doc) {
>  if (doc.lat && doc.lng) {
>    emit([doc.lat, doc.lng], [doc._id, doc.rating, doc.name,
> doc.description]);
>  }
> }

I suspect I may be misunderstanding what you are trying to do.  If you
want to query for keys from the above view such that: a < doc.lat < b
and x < doc.lng < y, then I think you can do just that:

startkey = [a, x]
endkey = [b, y]

Is that what you want?


+ seth

Mime
View raw message