couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Gagne <ga...@mit.edu>
Subject Re: Filtering a cloud of points
Date Wed, 04 Mar 2009 11:38:38 GMT
Not sure if this is the best, or a workable solution , I haven't tried
it, but it may lead to one.  If you look at :
http://wiki.apache.org/couchdb/View_collation?action=show&redirect=ViewCollation
  It shows how views are collated at the bottom.

The example you posted could be solved by doing 3 requests - all
points in each row, and then combining them in your code:

startkey=[[1],[0]]&endkey=[[1],[5]]
startkey=[[2],[0]]&endkey=[[2],[5]]
startkey=[[3],[0]]&endkey=[[3],[5]]

Hope that helps,

danny

On Wed, Mar 4, 2009 at 6:19 AM, Manuel Padrón Marártínez
<manolopm@banot.net> wrote:
> Hi :
>
> I have a problem with views (again). I have a cloud of points in a 2d space, I mean each
point has X
> and Y position, and each point is in a document:
>
> {
>  "Point":
>      {
>        "X":20,
>        "Y":30
>      }
> }
>
> I need to make a view to filter a region of space, I mean all the points between X0-X1
and Y0-Y1.
> I've tried to make a view like this:
>
> MAP:
> function(doc) {
>  emit([[doc.X],[doc.Y]], doc);
> }
>
> And tried to filter with start - end key (for example : startkey=[[1],[0]]&endkey=[[3],[5]])
but I
> get points that are out of region (like [[1][9]]).
> I've also tried with objects, simple vectos ([X,Y]) and still the same results.
>
> Anyone knows how to solve it? There any way ? Or should I make a view for X coordinate,
another for Y
> coordinate and try to make a ""join"" in my program?
>
> Thanks in advance
>
> Manuel Padrón Martínez
>

Mime
View raw message