Re: use of geometric types in select ?

From: "Victor Yegorov" <viy(at)pirmabanka(dot)lv>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: use of geometric types in select ?
Date: 2003-03-01 08:37:30
Message-ID: 20030301083730.GA9377@pirmabanka.lv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* dhoubrechts <dhoubrechts(at)cybernet(dot)be> [01.03.2003 03:32]:
> I create a db : createdb geo
> I log into the db : psql geo
> I create a table named poly :
> geo=# create table poly (parc varchar(15), graphic polygon);
>
> I populate the table :
> insert into poly values('A52','(2,1),(1,3),(2,5),(4,6),(6,4),(5,2)');
> insert into poly values('A135','(3,3),(7,4),(8,2),(4,1)');
>
> Now I would look if the first polygon overlaps the second using the
> varchars for retriving the poly.
> I could do it so :
> geo=# select '((2,1),(1,3),(2,5),(4,6),(6,4),(5,2))'::polygon &&
> '((3,3),(7,4),(8,2),(4,1))'::polygon;
> ?column?
> ----------
> t
> (1 row)
> Now, how can I do to have something like :
> geo=# select graphic::polygon from poly where parc='A52' && select
> graphic::polygon from poly where parc='A135';

Something like this:
select (g1.graphic && g2.graphic) from poly g1, poly g2
where g1.parc = 'A52' and g2.parc = 'A135';

--

Victor Yegorov

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Victor Yegorov 2003-03-01 08:41:26 Re: Beginner needs help
Previous Message Greg Stark 2003-03-01 06:22:39 Re: Beginner needs help