I've been googling up a storm, now that I've got a local postgis database with QGIS. But still haven't figured out how to display a newly created table. <br><br>The query I used to create the table:<br><div style="margin-left:40px">
CREATE TABLE smaller_leg_final AS<br>SELECT ST_Buffer(geom,-500) AS geom, legislative_final.district<br>FROM legislative_final<br>WHERE area > 30;<br></div><br>I then discovered that I needed a unique ID, and did the following:<br>
<div style="margin-left:40px">ALTER TABLE smaller_leg_final ADD COLUMN id serial not null;<br></div><br>This successfully populated the ID field with unique integers.<br><br>However when I go into QGIS, the Primary Key column offers no options. when I click into it, it just asks me to choose an SRID, which I believe I've already done. The table loads, but nothing displays. <br>
<br>I honestly feel a bit like a toddler given ice skates and placed on an icy rink. I'm toddling my way around, falling, getting back up, and then looking up and asking: why did I fall?<br><br>Once upon a time I was at the true cutting edge of GIS... I purchased MapInfo versions 1.1, and upgraded from there for many years. Moving into QGIS/Posgres/postGIS now, and well on the path to success, but .... not... quite... there.<br>
<br>Are there any QGIS users here who can help me to display my new table?<br><br>Do I need a different postgres statement? Is there a different field name expected? Maybe my query generated invalid shapes... But still, the geom field is displaying in the "Add PostGIS layers "Geometry column", but the Primary key column option doesn't allow me to select my 'id' field.<br>
<br>Insight welcome.<br><br><br><br><br clear="all"><div><div>--</div><div><a href="http://FarmBillPrimer.org" target="_blank">http://FarmBillPrimer.org</a></div><a href="http://www.BaltimoreUrbanAg.org" target="_blank">http://www.BaltimoreUrbanAg.org</a> (Please send events; This site is hungry.)<br>
<a href="http://www.ExcellentNutrition.org" target="_blank">http://www.ExcellentNutrition.org</a><br><a href="http://www.packtpub.com/drupal-5-views-recipes/book" target="_blank">http://www.packtpub.com/drupal-5-views-recipes/book</a><br>
</div>
<br><br><div class="gmail_quote">On Thu, Apr 4, 2013 at 11:21 AM, Lelo - Luiz Rogério De Pieri <span dir="ltr"><<a href="mailto:lelo.pieri@gmail.com" target="_blank">lelo.pieri@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div>Hi all,<br><br></div>I'm having a problem to execute a pgsql2shp command using java.<br><br></div>My OS is Ubuntu and it's frequently I use to generate shp files using pgsql2shp, but now I want to do it <span lang="en"><span>through java.<br>
<br></span></span></div><div><span lang="en"><span>The follow command works fine on terminal<br>pgsql2shp -f pontos_05600202_teste -h myhost -u myuser -P mypasswd -g coordinates my_database "SELECT * from points where id_uploaded_file = 37995";<br>
<br></span></span></div><div><span lang="en"><span>Now I'm trying to execute the follow code:<br><br><span style="font-family:courier new,monospace">ProcessBuilder pb = new ProcessBuilder("pgsql2shp", "-f pontos_05600202_teste", "-h myhost", "-u myuser", "-P mypasswd", "-g </span></span></span><span lang="en"><span><span style="font-family:courier new,monospace"><span lang="en"><span><span style="font-family:courier new,monospace">coordinates</span></span></span>", "my_database", "SELECT coordinates, date from points where id_uploaded_file = 37995");<br>
<br>Process proc;<br>proc = pb.start();<br>InputStream stdin = proc.getInputStream();<br>InputStreamReader isr = new InputStreamReader(stdin);<br>BufferedReader br = new BufferedReader(isr);<br><br>String line = null;<br>
System.out.println("<OUTPUT>");<br><br>while ((line = br.readLine()) != null)<br> System.out.println(line);<br><br>System.out.println("</OUTPUT>");<br>int exitVal = proc.waitFor();<br>System.out.println("Process exitValue: " + exitVal);</span><br>
</span></span></div><div><br clear="all"><div><div><div><div><div><div><div><div><br></div><div>And the result is:<br><br><span style="font-family:courier new,monospace"><OUTPUT><br>Preparing table for user query... Done.<br>
Initializing... </span><span style="font-family:courier new,monospace"><span lang="en"><span><span style="font-family:courier new,monospace">coordinates</span></span></span>: no such attribute in table __pgsql2shp14493_tmp_table<br>
</OUTPUT></span><br><br></div><div>Does anybody as any idea about it?<br><br></div><div>Thank you for all<br><br>Best regards<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>
-- <br>Rogério De Pieri (Lelo)<div>SCJP 5<br><div><div>Buscando melhorar a cada dia<br>
Áudio, Hardware & Software</div></div><div><a href="http://www.twitter.com/lelopieri" target="_blank">www.twitter.com/lelopieri</a></div><div><a href="http://blogdolelo.wordpress.com" target="_blank">blogdolelo.wordpress.com</a></div>
</div>
</div></font></span></div></div></div></div></div></div></div></div></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
<br></blockquote></div><br>