A simple way to see data in Quantum whilst running queries in Postgis is to 
write and test the query in Postgis then wrap it in a view. eg.

SELECT DISTINCT a.* FROM table1 a, table2 b WHERE ST_INTERSECTS(a.the_geom, 
b.the_geom)

can be written as

CREATE VIEW myview AS (SELECT DISTINCT a.* FROM table1 a, table2 b WHERE 
ST_INTERSECTS(a.the_geom, b.the_geom))

Provided there is a a field in the view that can be used as a key (the GID is a 
good one) then Quantum will display it.

If  there is not a unique key (eg. if you use intersects and get multiple gids 
then you can use CREATE TABLE and then add a Primary Key and populate geometry 
columns eg:

CREATE TABLE  mytable AS (SELECT a.* FROM table1 a, table2 b WHERE 
ST_INTERSECTS(a.the_geom, b.the_geom))

ALTER
TABLE mytable
ADD
COLUMN id SERIAL PRIMARY KEY;
SELECT POPULATE_GEOMETRY_COLUMNS('public.mytable'::regclass);

Then it will be visible from Quantum.

Hope this helps

Phil


>________________________________
>From: Carlos Andrade <[email protected]>
>To: PostGIS Users Discussion <[email protected]>
>Sent: Thursday, 3 November 2011, 8:03
>Subject: Re: [postgis-users] PostGIS Conceptual and Phisical Modelling
>
>
>Hi,
>
>
>Thank you everyone for all your suggestions! I'm gonna check on them! =) 
>
>
>Paolo, I'm happy someone will find use of it, where should I put it?  
>
>
>
>Carlos Andrade
>
>http://carlosandrade.co
>
>
>
>2011/11/3 Paolo Cavallini <[email protected]>
>
>Il 02/11/2011 18:55, Carlos Andrade ha scritto:
>>
>>
>>> I've created a small tutorial on how I got things wokrking around to set up 
>>> on a snow
>>> leopard it, is this of any interest to this comunity? It may have 
>>> information that it
>>> not 100% accurate, but it was what made it work on my mac. If yes, please 
>>> let me know
>>> where could I put it (maybe the wiki, or where would it be).
>>
>>Yes, please.
>>All the best.
>>--
>>Paolo Cavallini - Faunalia
>>www.faunalia.eu
>>Full contact details at www.faunalia.eu/pc
>>
>>_______________________________________________
>>postgis-users mailing list
>>[email protected]
>>http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>
>_______________________________________________
>postgis-users mailing list
>[email protected]
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to