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" <[email protected]> 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


Reply via email to