incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <robert.new...@gmail.com>
Subject Re: get item by longitude and latitude inside a square
Date Mon, 15 Mar 2010 16:54:25 GMT
couchdb-lucene 0.5 can also do bounding box searches;

?q=pizza AND lat<double>:[51.4707 TO 51.5224] AND
long<double>:[-0.6622 TO -0.5775]

0.5 isn't released (yet) but it's fairly stable at this point.

B.

On Mon, Mar 15, 2010 at 4:50 PM, Christopher O'Connell
<jwriteclub@gmail.com> wrote:
> You cannot do true "bounding box" queries with couch. You'll need to use one
> of teh geo-indexing solutions for that.
>
> 2010/3/15 Stéphane Mourey <stephane.mourey@gmail.com>
>
>> Here is the first lines of the view output, without startkey and endkey
>> (i.e. sofitex/_design/all/_view/getVillesByLatAndLong)
>>
>> {"total_rows":73751,"offset":0,"rows":[
>>
>> {"id":"2ab960eb967f8d14f5b6bc1837c2c7fa","key":["",""],"value":{"_id":"2ab960eb967f8d14f5b6bc1837c2c7fa","_rev":"1-bbd075701f8fb02ec7578c71dd631113","type":"ville","id":"142787","nom":"Monaco","cp":"98000","long":"","lat":"","country":"fr"}},
>>
>> {"id":"6f27cc15079e4317cb6488741abfdec1","key":["-0.015","48.1033"],"value":{"_id":"6f27cc15079e4317cb6488741abfdec1","_rev":"1-435bccb2ad1a150099dd4dd2c0f412c0","type":"ville","id":"133962","nom":"La
>> Chapelle St
>> Fray","cp":"72240","long":"48.1033","lat":"-0.015","country":"fr"}},
>>
>> Here is the output, given startkey and endkey (i.e.
>>
>> /sofitex/_design/all/_view/getVillesByLatAndLong?startkey=%5B6.84505190241%2C47.6459660001%5D&amp;endkey=%5B8.64494809759%2C49.4624339999%5D&amp;include_docs=true):
>>
>> {"total_rows":73751,"offset":0,"rows":[]}
>>
>> I get the same when startkey is [0,0] and endkey is [999,999] (i.e.
>>
>> /sofitex/_design/all/_view/getVillesByLatAndLong?startkey=[0%2C0]&amp;endkey=[999%2C999]&amp;include_docs=true),
>> but what is expected is all the cities.
>>
>> 2010/3/15 Alex P <apedenko@kolosy.com>
>>
>> > more than likely it's an issue with actual collation vs what you're
>> > expecting. care to show some sample view output?
>> >
>> > 2010/3/15 Stéphane Mourey <stephane.mourey@gmail.com>
>> >
>> > > Hi all,
>> > >
>> > > I have a database where cities (villes in french) are stored, with
>> > > longitude
>> > > and latitude values. I'm trying to get some of them, inside a square.
>> > > Here is one request:
>> > >
>> > >
>> > >
>> >
>> /sofitex/_design/all/_view/getVillesByLatAndLong?startkey=%5B6.84505190241%2C47.6459660001%5D&amp;endkey=%5B8.64494809759%2C49.4624339999%5D&amp;include_docs=true
>> > >
>> > > Here is the view code:
>> > >
>> > >   "getVillesByLatAndLong": {
>> > >       "map": "function(doc) {if (doc.type=='ville')
>> > > {emit([doc.lat,doc.long], doc);};}"
>> > >   }
>> > > The result is empty, but I know I have some cities that match. Could
>> > anyone
>> > > tell what's wrong?
>> > >
>> > > Best regards,
>> > >
>> > > Stephane Mourey
>> > >
>> >
>>
>

Mime
View raw message