couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher O'Connell <jwritec...@gmail.com>
Subject Re: Range query for more than one dimension (coordinates)
Date Tue, 01 Dec 2009 22:04:04 GMT
I also have externalj for this

http://compu.terlicio.us/code/externalj

~ Christopher

Sent from my iPhone

On Dec 1, 2009, at 14:42, "Michael McCaffrey" <mmccaffrey@ittvis.com>  
wrote:

> And this one describing how to use using _lists
>
> http://vmx.cx/cgi-bin/blog/index.cgi/poor-mans-bounding-box-queries-with-couchdb:2009-07-19:en,CouchDB,JavaScript,geo
>
>
>
> -----Original Message-----
> From: Paul Davis [mailto:paul.joseph.davis@gmail.com]
> Sent: Tuesday, December 01, 2009 2:30 PM
> To: user@couchdb.apache.org
> Subject: Re: Range query for more than one dimension (coordinates)
>
> On Tue, Dec 1, 2009 at 4:24 PM, robert <robber2@gmx.de> wrote:
>> Hi list,
>>
>> I'm currently building a db of documents with locations. Each  
>> document has a
>> latitude and longitude (in decimal degrees, so it's basically two  
>> floats).
>>
>> Now I need a way to select documents within a "rectangle area"  
>> defined by
>> two coordinates. I tried mapping documents to [doc.lat, doc.lon]  
>> and doing a
>> range query on that, but after reading the view documentation  
>> again, it
>> seems that this is not the way to go. (Because I will always get  
>> all docs
>> with matching latitude first, even if longitude is out of range)
>>
>> I could always do two separate range queries (one for lat, one for  
>> lon) and
>> then intersect in client code, but that seems inelegant to me.
>>
>> Is there a better way to do this?
>>
>> TIA,
>> robert
>>
>> p.s. simple example just in case:
>>
>> I have docs like
>> [{"_id": "a", "lat": 10, "lon": 10},
>>  {"_id": "b", "lat": 15, "lon": 15},
>>  {"_id": "c", "lat": 20, "lon": 11}]
>>
>> and need to query e.g. for documents between lat 9, lon 9 and lat  
>> 25, lon 12
>> returning "a" and "c" but not "b"
>>
>
> Have you seen GeoCouch?
>
> http://vmx.cx/cgi-bin/blog/index.cgi/geocouch-geospatial-queries-with-couchdb:2008-10-26:en,CouchDB,Python,geo
>
> HTH,
> Paul Davis

Mime
View raw message