Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 34007 invoked from network); 14 Jun 2009 22:18:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Jun 2009 22:18:16 -0000 Received: (qmail 60664 invoked by uid 500); 14 Jun 2009 22:18:27 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 60568 invoked by uid 500); 14 Jun 2009 22:18:26 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 60557 invoked by uid 99); 14 Jun 2009 22:18:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Jun 2009 22:18:26 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of timburgess@mac.com designates 17.148.16.92 as permitted sender) Received: from [17.148.16.92] (HELO asmtpout017.mac.com) (17.148.16.92) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Jun 2009 22:18:13 +0000 MIME-version: 1.0 Content-type: multipart/alternative; boundary="Boundary_(ID_rrOBzijKTA5VnaNWOQw0AA)" Received: from [10.0.1.2] (115-64-250-70.tpgi.com.au [115.64.250.70]) by asmtp017.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KL9005JN1XOQ520@asmtp017.mac.com> for user@couchdb.apache.org; Sun, 14 Jun 2009 15:17:52 -0700 (PDT) Cc: volker.mische@gmail.com Message-id: From: Tim Burgess To: user@couchdb.apache.org In-reply-to: Subject: Re: Retrieving documents that have a latitude and longitude intersection Date: Mon, 15 Jun 2009 08:17:47 +1000 References: <2C1A5D65-F929-42B8-93CE-A9BB68C8D1DA@mac.com> <8508f1c80906141226i2be52f9dt2556c3c1a3d30e15@mail.gmail.com> X-Mailer: Apple Mail (2.935.3) X-Virus-Checked: Checked by ClamAV on apache.org --Boundary_(ID_rrOBzijKTA5VnaNWOQw0AA) Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-transfer-encoding: 7BIT >> >> 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] >> Thanks guys. Yes, using arrays clearly wasn't doing the job after a little bit of experimentation - I thought there might have been some 'trick' I was missing. Volker, if you could point me to your code I would like to try it out. This is a 'must have' thing for me as without it, it's pretty much impossible to use couchdb for my app. Yes, I could do two queries from the browser but paying for unwanted data across the wire and putting extra load on the browser is not a solution for me. Bounding box is all I need and I could scrape by without anything else for the time being so I'd be happy to try GeoCouch. The link to Paul Davis' external2 couchdb branch from the link you provided goes nowhere on github by the way. Cheers, Tim > This will also bring back rows with eg the key [b, w] which is outside > the wanted range. > > The simple answer is to have two maps: one by lat and one by long, and > query them both, intersecting to find the rows in both queries (or > more simply to just query for a longitude range and filter the results > by lattitude.) This is not very efficient and hence there are > dedicated strategies for geo indexing. > > GeoCouch is probably the best solution, or you could do the work to > integrate another geographic indexer. Adding alternate indexers to > CouchDB is about as simple as can be, so don't be put off by the idea. > >> Is that what you want? >> >> >> + seth >> > > > > -- > Chris Anderson > http://jchrisa.net > http://couch.io Tim Burgess timburgess@mac.com Kyoto Podcast - Glimpses of Japan www.kyotopodcast.jp --Boundary_(ID_rrOBzijKTA5VnaNWOQw0AA)--