You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Manolo Padron Martinez <ma...@gmail.com> on 2009/06/14 14:02:41 UTC

Re: Retrieving documents that have a latitude and longitude intersection

I've been trying to do complex searchs (like two ranged variables) and
the solution for me was to use couch-lucene
(http://rnewson.github.com/couchdb-lucene/) to index the documents. If
anyone has a better solution that could be done only with chouch would
be great to hear about it.

Regards from Canary Islands

Manuel Padrón Martínez


On Sun, Jun 14, 2009 at 9:12 AM, Tim Burgess<ti...@mac.com> wrote:
> I've run up couchdb and am trying to use it to serve JSON requests from a
> browser javascript application (using google maps).
> I've been doing this with MySQL and RoR but the replication and the ability
> to simply add image attachments is very appealing to me.
>
> 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'm fortunate in that I'm only having to deal with an area that doesn't
> cross the equator or prime meridian so essentially I just need to query
> two floats that fall within ranges provided by startkey and endkey. I'd be
> very grateful if someone had some idea as to how to do this..
>
> Cheers!
>
> Tim Burgess
> timburgess@mac.com
>