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 <[email protected]> > 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&endkey=%5B8.64494809759%2C49.4624339999%5D&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]&endkey=[999%2C999]&include_docs=true), > but what is expected is all the cities. > > 2010/3/15 Alex P <[email protected]> > > > 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 <[email protected]> > > > > > 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&endkey=%5B8.64494809759%2C49.4624339999%5D&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 > > > > > >
