You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Chris Costakes <cc...@gmail.com> on 2013/05/17 14:12:40 UTC

Spacial search with GeoCouch

Using CouchDB (and GeoCouch), I have a document type of Location with a
center coordinate (lat & long).  I am able to query with a bbox query just
fine by feeding in a northwest longitude/latitude and a southwest
longitude/latitued. My location doc also has an attribute called Users
where I have an array of user id's. I would like to be able to perform a
bbox with the addition of filtering by a specific user in the Users array.
Is this possible?

The reason important is because I may have millions of different location
documents, each with a list of users in the User array (maybe hundreds of
user tags per location). I'm trying to find a list of locations for a group
of users. So I have 3 users for a particular search and I want to find all
of the locations for these users within a given boundry. The only way I can
think to handle this scenario is to perform the bbox spatial query first
and then loop through the result set to determine if the user matches the
list of the 3 users. This would mean looping through a potentially very
large original result set (the list of locations). Would love to add an
additional dimension to my bbox query to filter also by user, but I can't
figure out how to accomplish this or whether it is possible. Thank you!

Re: Spacial search with GeoCouch

Posted by Chris Costakes <cc...@gmail.com>.
Not transferring the data to the client would definitely help quite a bit.
 I haven't used list functions before but will give it a try.
Thank you!


On Fri, May 17, 2013 at 8:34 AM, Volker Mische <vo...@gmail.com>wrote:

> On 05/17/2013 02:12 PM, Chris Costakes wrote:
> > Using CouchDB (and GeoCouch), I have a document type of Location with a
> > center coordinate (lat & long).  I am able to query with a bbox query
> just
> > fine by feeding in a northwest longitude/latitude and a southwest
> > longitude/latitued. My location doc also has an attribute called Users
> > where I have an array of user id's. I would like to be able to perform a
> > bbox with the addition of filtering by a specific user in the Users
> array.
> > Is this possible?
> >
> > The reason important is because I may have millions of different location
> > documents, each with a list of users in the User array (maybe hundreds of
> > user tags per location). I'm trying to find a list of locations for a
> group
> > of users. So I have 3 users for a particular search and I want to find
> all
> > of the locations for these users within a given boundry. The only way I
> can
> > think to handle this scenario is to perform the bbox spatial query first
> > and then loop through the result set to determine if the user matches the
> > list of the 3 users. This would mean looping through a potentially very
> > large original result set (the list of locations). Would love to add an
> > additional dimension to my bbox query to filter also by user, but I can't
> > figure out how to accomplish this or whether it is possible. Thank you!
>
> Hi Chris,
>
> you currently can't query for another attribute. You could also try a
> _list function [1], it would then be handled on the server side and not
> transfer all the data to the client side.
>
> [1] https://couchdb.readthedocs.org/en/latest/ddocs.html#list-functions
>
> Cheers,
>   Volker
>

Re: Spacial search with GeoCouch

Posted by Volker Mische <vo...@gmail.com>.
On 05/17/2013 02:12 PM, Chris Costakes wrote:
> Using CouchDB (and GeoCouch), I have a document type of Location with a
> center coordinate (lat & long).  I am able to query with a bbox query just
> fine by feeding in a northwest longitude/latitude and a southwest
> longitude/latitued. My location doc also has an attribute called Users
> where I have an array of user id's. I would like to be able to perform a
> bbox with the addition of filtering by a specific user in the Users array.
> Is this possible?
> 
> The reason important is because I may have millions of different location
> documents, each with a list of users in the User array (maybe hundreds of
> user tags per location). I'm trying to find a list of locations for a group
> of users. So I have 3 users for a particular search and I want to find all
> of the locations for these users within a given boundry. The only way I can
> think to handle this scenario is to perform the bbox spatial query first
> and then loop through the result set to determine if the user matches the
> list of the 3 users. This would mean looping through a potentially very
> large original result set (the list of locations). Would love to add an
> additional dimension to my bbox query to filter also by user, but I can't
> figure out how to accomplish this or whether it is possible. Thank you!

Hi Chris,

you currently can't query for another attribute. You could also try a
_list function [1], it would then be handled on the server side and not
transfer all the data to the client side.

[1] https://couchdb.readthedocs.org/en/latest/ddocs.html#list-functions

Cheers,
  Volker