<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><span>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.</span></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><span><br></span></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><span>SELECT DISTINCT a.* FROM table1 a, table2 b WHERE ST_INTERSECTS(a.the_geom, b.the_geom)</span></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><span><br></span></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><span>can be written as</span></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><span><br></span></div><div style="font-size: 12pt;
 font-family: arial, helvetica, sans-serif; "><span>CREATE VIEW myview AS (</span>SELECT DISTINCT a.* FROM table1 a, table2 b WHERE ST_INTERSECTS(a.the_geom, b.the_geom))</div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><br></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; ">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.</div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><br></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; ">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:</div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><br></div><div><font class="Apple-style-span" face="'Courier New', courier, monaco, monospace,
 sans-serif"><span>CREATE TABLE  mytable AS (</span><font class="Apple-style-span" size="3">SELECT a.* FROM table1 a, table2 b WHERE ST_INTERSECTS(a.the_geom, b.the_geom))</font><br></font></div><div><div style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0in; text-align: left; direction: ltr; unicode-bidi: embed; word-break: normal; "><font class="Apple-style-span" face="'Courier New', courier, monaco, monospace, sans-serif"><span>ALTER
TABLE </span><span>mytable</span></font></div>

<div style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0in; text-align: left; direction: ltr; unicode-bidi: embed; word-break: normal; "><span><font class="Apple-style-span" face="'Courier New', courier, monaco, monospace, sans-serif">ADD
COLUMN id SERIAL PRIMARY KEY;</font></span></div>

<div style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0in; text-align: left; direction: ltr; unicode-bidi: embed; word-break: normal; "></div>

<div style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0in; text-align: left; direction: ltr; unicode-bidi: embed; word-break: normal; "><font class="Apple-style-span" face="'Courier New', courier, monaco, monospace, sans-serif">SELECT
POPULATE_GEOMETRY_COLUMNS('<span>public.mytable</span><span>'::</span>regclass<span>);</span></font></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; margin-top: 0pt; margin-bottom: 0pt; margin-left: 0in; text-align: left; direction: ltr; unicode-bidi: embed; word-break: normal; "><span style="font-size: 17pt; font-family: 'Courier New'; "><br></span></div><div style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0in; text-align: left; direction: ltr; unicode-bidi: embed; word-break: normal; "><span><span>Then it will be visible from Quantum.</span></span></div><div style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0in; text-align: left; direction: ltr; unicode-bidi: embed; word-break: normal; "><span><span><br></span></span></div><div style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0in; text-align: left; direction: ltr; unicode-bidi: embed; word-break: normal; "><span><span>Hope this
 helps</span></span></div></div><div style="font-size: 12pt; "><br></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; ">Phil<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; "><div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "><font size="2" face="Arial"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Carlos Andrade <carlosviansi@gmail.com><br><b><span style="font-weight: bold;">To:</span></b> PostGIS Users Discussion <postgis-users@postgis.refractions.net><br><b><span style="font-weight: bold;">Sent:</span></b> Thursday, 3 November 2011, 8:03<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [postgis-users] PostGIS Conceptual and Phisical Modelling<br></font><br><div id="yiv1564607065">Hi,<div><br></div><div>Thank you everyone
 for all your suggestions! I'm gonna check on them! =) </div><div><br></div><div>Paolo, I'm happy someone will find use of it, where should I put it?  </div><div><br></div><div>

<br clear="all">Carlos Andrade<br>

<div><a rel="nofollow" target="_blank" href="http://carlosandrade.co">http://carlosandrade.co</a></div><br>
<br><br><div class="yiv1564607065gmail_quote">2011/11/3 Paolo Cavallini <span dir="ltr"><<a rel="nofollow" ymailto="mailto:cavallini@faunalia.it" target="_blank" href="mailto:cavallini@faunalia.it">cavallini@faunalia.it</a>></span><br><blockquote class="yiv1564607065gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">



Il 02/11/2011 18:55, Carlos Andrade ha scritto:<br>
<div><br>
> I've created a small tutorial on how I got things wokrking around to set up on a snow<br>
> leopard it, is this of any interest to this comunity? It may have information that it<br>
> not 100% accurate, but it was what made it work on my mac. If yes, please let me know<br>
> where could I put it (maybe the wiki, or where would it be).<br>
<br>
</div>Yes, please.<br>
All the best.<br>
<span><font color="#888888">--<br>
Paolo Cavallini - Faunalia<br>
<a rel="nofollow" target="_blank" href="http://www.faunalia.eu">www.faunalia.eu</a><br>
Full contact details at <a rel="nofollow" target="_blank" href="http://www.faunalia.eu/pc">www.faunalia.eu/pc</a><br>
</font></span><div><div>_______________________________________________<br>
postgis-users mailing list<br>
<a rel="nofollow" ymailto="mailto:postgis-users@postgis.refractions.net" target="_blank" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a rel="nofollow" target="_blank" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br></div>
</div><br>_______________________________________________<br>postgis-users mailing list<br><a ymailto="mailto:postgis-users@postgis.refractions.net" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br><br><br></div></div></blockquote></div></div></body></html>