couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Florian Westreicher Bakk.techn." <st...@meredrica.org>
Subject Re: use startkey/endkey to discribe a range problem
Date Wed, 11 Dec 2013 19:16:12 GMT
That's an interesting idea but it will not work in all situations. You could not query for
areas that span multiple quadrants. If you would like to get all locations around 0,0 in a
20km square this won't work. 

Vivek Pathak <vpathak@orgmeta.com> wrote:
>You can replicate the two dimensional neighborhood by mapping the 
>resursive partitioning of the lat-lon range into key components.
>
>Eg: lets say you start with north south axis first, if your location is
>
>north of equator, add the first caharacter n to the key, else add s.  
>Next check if your location is east or west of equator. If east, then 
>emit e, else emit west.
>
>At this first stage of recursion,  you have narrowed down from entire 
>globe to one quadrant.    Now consider the center of this quadrant and 
>emit a n or s depending on whether your location is north or south or 
>it, and then e or w depending on whether it is east or west.  Now you 
>have location within 1/16 of the globe.
>
>Keep repeating to get accuracy as desired.
>
>For rxample :
>neswnesenwsesesenwswswnwsenwswnwsenwnwnesenwnese would be the code for 
>(28.5355161 N , 77.39102649999995 E )
>
>Because nearby locations would share the most significant places in the
>
>key,  they can be traversed and located using some location prefix.
>
>
>On 12/8/13, 10:55 AM, Robert Newson wrote:
>> CouchDB views are one dimensional so you will not succeed with a two
>> dimensional geo query. You could try couchdb-lucene which can.
>> On 8 Dec 2013 15:51, "Qaqabincs" <lujing7@gmail.com> wrote:
>>
>>> I use a view to query an area, and emit [lng, lat] as key, so I use
>>> "...?startkey=[min_lng, min_lat]&endkey=[max_lng, max_lat]" to help
>find
>>> out all place within the quadranglar area, but the results are
>exactly
>>> between x?[min_lng, max_lng]&y?[-?, +? ] and x?[-?, +?]&y?[min_lat,
>>> max_lat] (like a cross-shaped stripe area).
>>>
>>> what is the correct usage of startkey/endkey to express a
>quadranglar area?
>>>
>>> -----------------------------
>>> qaqabincs
>>>

-- 
Sent from Kaiten Mail. Please excuse my brevity.

Mime
View raw message