You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Martin Sarsale <ma...@malditainternet.com> on 2009/02/19 19:30:31 UTC

designing a GIS app using couchdb

Heyas, I'm about to start my first couchdb app and I would like some
help designing the "document structure".

I would like to store Places and Events. A Place can be a Restaurant,
a MovieTheather or just a point in the map. An Event can be a special
dinner in the Restaurant, a movie in the MovieTeather, etc.

Storing Places sounds easy to me: I'll have a Type field which will be
something like ["Place","Restaurant"], a name and lat & long (probably
going to use geojson here) and some custom fields for each document
type.

Now, I'm not too sure what is the natural id of the Place documents:
the place name is an option, but probably there's going to be more
than one place with the same name. Any hints?

Then, the Event documents are not that obvious to me: since Events
occur in Places, a relationship between both is needed. I read about
the example with the blog comments and I thought I could apply
something similar here:

{
Type: 'Event',
PlaceID: 'TheatherX',
Name: "Pineapple Express"
}

What do you think? I'm also not sure about the natural ID for the
event. Help! :)

Also, I plan to support at  least some of the repeating features of
iCal (daily, weekly, yearly). I think this will be much easier to do
in couchdb than in a rdbms, but I would -love- to know if someone
implemented something similar.

I would appreciate if someone has pointers GIS + couchdb doc (I've
already found http://vmx.cx/cgi-bin/blog/index.cgi/category/CouchDB )

Thanks!

PD: bonus question, I'm planning to use Python and Django for the app,
what's the recommended couchdb module for py?



-- 
Martin Sarsale - martin@malditainternet.com

Re: designing a GIS app using couchdb

Posted by Rhett Garber <rh...@gmail.com>.
On Thu, Feb 19, 2009 at 1:40 PM, Martin Sarsale
<ma...@malditainternet.com> wrote:
> On Thu, Feb 19, 2009 at 5:35 PM, Rhett Garber <rh...@gmail.com> wrote:
>> On Thu, Feb 19, 2009 at 10:30 AM, Martin Sarsale
>> <ma...@malditainternet.com> wrote:
>>> Now, I'm not too sure what is the natural id of the Place documents:
>>> the place name is an option, but probably there's going to be more
>>> than one place with the same name. Any hints?
>>
>> I'm a little biased, and this has nothing to do with couchdb,
>> but I might recommend using the Yelp API for your businesses. If you
>> use the Phone number API
>> (http://www.yelp.com/developers/documentation/phone_api) you can a lot
>> of good 'place' metadata as well
>> as a unique id.
>
> YELP API looks good, but unfortunately (not!) there're other countries
> on earth apart from US and I happen to live in one of those :)
> anyway, using the phone # for ID sounds good, maybe I could add a prefix?

True. It should also support UK and Canada, but that's still a pretty
limited set.

You could also generate some pseudo random id (or let couchdb generate
one) and use
a view and whatever criteria you want to find already created locations.

Rhett

Re: designing a GIS app using couchdb

Posted by Martin Sarsale <ma...@malditainternet.com>.
On Thu, Feb 19, 2009 at 5:35 PM, Rhett Garber <rh...@gmail.com> wrote:
> On Thu, Feb 19, 2009 at 10:30 AM, Martin Sarsale
> <ma...@malditainternet.com> wrote:
>> Now, I'm not too sure what is the natural id of the Place documents:
>> the place name is an option, but probably there's going to be more
>> than one place with the same name. Any hints?
>
> I'm a little biased, and this has nothing to do with couchdb,
> but I might recommend using the Yelp API for your businesses. If you
> use the Phone number API
> (http://www.yelp.com/developers/documentation/phone_api) you can a lot
> of good 'place' metadata as well
> as a unique id.

YELP API looks good, but unfortunately (not!) there're other countries
on earth apart from US and I happen to live in one of those :)
anyway, using the phone # for ID sounds good, maybe I could add a prefix?

>
>> PD: bonus question, I'm planning to use Python and Django for the app,
>> what's the recommended couchdb module for py?
>
> The couchdb python library (http://code.google.com/p/couchdb-python/)
> seems to best from my perspective (not django).
>  Some of the others do more ORM type stuff for you, which might be
> more useful for django I dunno.

tnx
>



-- 
Martin Sarsale - martin@malditainternet.com

Re: designing a GIS app using couchdb

Posted by Rhett Garber <rh...@gmail.com>.
On Thu, Feb 19, 2009 at 2:55 PM, Sho Fukamachi <sh...@gmail.com> wrote:

> http://www.eastbayexpress.com/gyrobase/yelp_and_the_business_of_extortion_2_0/Content?oid=927491&page=1
>
> A company that pulls that kind of stunt is utterly untrustworthy. I wouldn't
> touch them with a 10-ft pole.

This seems like an inappropriate forum to debate such an issue, but:
http://officialblog.yelp.com/2009/02/kathleen-richards-east-bay-express.html

Rhett

Re: designing a GIS app using couchdb

Posted by Martin Sarsale <ma...@malditainternet.com>.
> A company that pulls that kind of stunt is utterly untrustworthy. I wouldn't
> touch them with a 10-ft pole.

yeah, ok; but the idea of using the phone # as key is good.

except:
1) very informal restaurants wont have a phone # (not big deal)
2) restaurant closes, phone # are reused (and maybe will be assigned
to other business)
3) phone # are not portable in every countries so if a shop moves,
maybe the phone # will change
4)  some places have more than 1 phone #

so, maybe, I'll have to use an UUID instead of a natural id :)


-- 
Martin Sarsale - martin@malditainternet.com

Re: designing a GIS app using couchdb

Posted by Sho Fukamachi <sh...@gmail.com>.
On 20/02/2009, at 6:35 AM, Rhett Garber wrote:
> I'm a little biased, and this has nothing to do with couchdb,
> but I might recommend using the Yelp API for your businesses.

Yelp? That company which overtly offers to manipulate its customer- 
generated reviews for financial gain?

http://www.eastbayexpress.com/gyrobase/yelp_and_the_business_of_extortion_2_0/Content?oid=927491&page=1

A company that pulls that kind of stunt is utterly untrustworthy. I  
wouldn't touch them with a 10-ft pole.

Sho


Re: designing a GIS app using couchdb

Posted by Rhett Garber <rh...@gmail.com>.
On Thu, Feb 19, 2009 at 10:30 AM, Martin Sarsale
<ma...@malditainternet.com> wrote:
> Now, I'm not too sure what is the natural id of the Place documents:
> the place name is an option, but probably there's going to be more
> than one place with the same name. Any hints?

I'm a little biased, and this has nothing to do with couchdb,
but I might recommend using the Yelp API for your businesses. If you
use the Phone number API
(http://www.yelp.com/developers/documentation/phone_api) you can a lot
of good 'place' metadata as well
as a unique id.

> PD: bonus question, I'm planning to use Python and Django for the app,
> what's the recommended couchdb module for py?

The couchdb python library (http://code.google.com/p/couchdb-python/)
seems to best from my perspective (not django).
 Some of the others do more ORM type stuff for you, which might be
more useful for django I dunno.