incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manuel Padrón Marártínez <manol...@banot.net>
Subject Filtering a cloud of points
Date Wed, 04 Mar 2009 11:19:38 GMT
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