incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manuel Padrón Martínez <manol...@banot.net>
Subject Re: Filtering a cloud of points
Date Wed, 04 Mar 2009 12:39:55 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.

I've read it but it don't seems to solve the problem trying to filter by two "ranged properties"
at 
the same time (like in the case) 

> The example you posted could be solved by doing 3 requests - all
> points in each row, and then combining them in your code:
> 
That doesn't work to me,because (in this case) X and Y are real numbers... I could make a
petition to 
get the X between X0-X1 and then get the Y between Y0-Y1 and try to make the join in my code.
But 
that is what I'm trying to avoid. I have read 
(http://www.eflorenzano.com/blog/post/why-couchdb-sucks/) and in the 7th comment talks about
a merge 
function that is not implemented yet .I think  merge will do what I want (two maps one for
X 
and one for Y and a merge that make a ""join""). Anyone knows the state of merge or if it
will be 
implemented ?

> 
> Hope that helps,

Thanks 

> 
> 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