pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: . <@babolo.ru>
To: dhoubrechts <dhoubrechts@cybernet.be>
Cc: pgsql-interfaces@postgresql.org <pgsql-interfaces@postgresql.org>
Subject: Re: use off geometric types
Date: Fri, 28 Feb 2003 02:32:03 +0300 (MSK)
Message-ID: <1046388723.861187.683.nullmailer@cicuta.babolo.ru> (raw)
In-Reply-To: <3E5E7C52.2138702B@cybernet.be>

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




view thread (3+ messages)

Message-ID: <1046388723.861187.683.nullmailer@cicuta.babolo.ru>
Permalink:  ../1046388723.861187.683.nullmailer@cicuta.babolo.ru/
Also on:    postgresql.org/message-id/1046388723.861187.683.nullmailer@cicuta.babolo.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: @babolo.ru, dhoubrechts@cybernet.be
  Subject: Re: use off geometric types
  In-Reply-To: <1046388723.861187.683.nullmailer@cicuta.babolo.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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