use of geometric types in select ?

From: dhoubrechts <dhoubrechts(at)cybernet(dot)be>
To: pgsql-sql(at)postgresql(dot)org
Subject: use of geometric types in select ?
Date: 2003-02-27 21:07:53
Message-ID: 3E5E7E29.58D19347@cybernet.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Thanks for help
Didier.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Itai Zukerman 2003-02-27 21:15:03 Re: GiST, Not Using Index
Previous Message Tom Lane 2003-02-27 20:51:42 Re: GiST, Not Using Index