pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feeduse off geometric types
3+ messages / 2 participants
[nested] [flat]
* use off geometric types
@ 2003-02-27 20:56 dhoubrechts <dhoubrechts@cybernet.be>
0 siblings, 0 replies; 3+ messages in thread
From: dhoubrechts @ 2003-02-27 20:56 UTC (permalink / raw)
To: pgsql-interfaces
I create a db : createdb geop
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 i 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 I 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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* use off geometric types
@ 2003-02-27 21:00 dhoubrechts <dhoubrechts@cybernet.be>
0 siblings, 1 reply; 3+ messages in thread
From: dhoubrechts @ 2003-02-27 21:00 UTC (permalink / raw)
To: pgsql-interfaces
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: use off geometric types
@ 2003-02-27 23:32 .@babolo.ru
parent: dhoubrechts <dhoubrechts@cybernet.be>
0 siblings, 0 replies; 3+ messages in thread
From: . @ 2003-02-27 23:32 UTC (permalink / raw)
To: dhoubrechts <dhoubrechts@cybernet.be>; +Cc: pgsql-interfaces
> 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';
SELECT a.graphic && b.graphic FROM poly a, poly b WHERE a.parc='A52' AND b.parc='A135';
But if you want to find all overlaps
SELECT a.parc, b.parc FROM poly a, poly b WHERE a.graphic && b.graphic;
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-02-27 23:32 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-27 20:56 use off geometric types dhoubrechts <dhoubrechts@cybernet.be>
2003-02-27 21:00 use off geometric types dhoubrechts <dhoubrechts@cybernet.be>
2003-02-27 23:32 ` .@babolo.ru
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox