You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by James Marca <jm...@translab.its.uci.edu> on 2010/08/20 19:41:53 UTC

Reduce in GeoCouch?

Hi, 

Apologies if this isn't the list for geocouch questions.

Are there any plans to support map/reduce for geocouch queries?  
In my use case, I am emitting geojson to OpenLayers.  Currently I am
using javascript in the client to reformat the list of values into a
single FeatureCollection object.

    {'type':'FeatureCollection', 'features':[ ...push rows[value] here... ]};

I did try just writing a map/reduce pair for the spatial member of
the design doc and hoped it would work, but it didn't work:

    {"error":"{<<\"compilation_error\">>,\n <<\"Expression does not eval
    to a function. (({map:\\\"function(doc) ... 

I am using a "custom" version of geocouch... a git pull from August 19
(commit f764bcb61df8d00904c39611868db5a3a40f4178) merged with couchdb
1.0.1, plus a few minor tweaks to resolve conflicts (git is *so great*
for merging code)

Regards, 
James

Re: Reduce in GeoCouch?

Posted by Volker Mische <vo...@gmail.com>.
On 20.08.2010 19:41, James Marca wrote:
> Hi,
>
> Apologies if this isn't the list for geocouch questions.
>
> Are there any plans to support map/reduce for geocouch queries?
> In my use case, I am emitting geojson to OpenLayers.  Currently I am
> using javascript in the client to reformat the list of values into a
> single FeatureCollection object.
>
>      {'type':'FeatureCollection', 'features':[ ...push rows[value] here... ]};
>
> I did try just writing a map/reduce pair for the spatial member of
> the design doc and hoped it would work, but it didn't work:
>
>      {"error":"{<<\"compilation_error\">>,\n<<\"Expression does not eval
>      to a function. (({map:\\\"function(doc) ...
>
> I am using a "custom" version of geocouch... a git pull from August 19
> (commit f764bcb61df8d00904c39611868db5a3a40f4178) merged with couchdb
> 1.0.1, plus a few minor tweaks to resolve conflicts (git is *so great*
> for merging code)
>
> Regards,
> James

Hi James,

this is the right place for GeoCouch questions.

You can't use map/reduce for spatial queries. You would need to make two 
separate queries and merge them. Though there is something like a 
multiview extension [1]. I haven't had the time to look into it yet, so 
I'm not sure if it would solve you problems, but I've read that it has 
GeoCouch support.

[1] http://github.com/normanb/couchdb-multiview

Cheers,
   Volker