Nicolas,<div>What I want to do is an insert of the type INSERT INTO...VALUES .. as follows:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div class="im">
INSERT INTO boundaries ( the_geom, the_name ) VALUES  (some_geometry_data,'some_arbitrary_name')</div></div></blockquote><div><div class="im"><br></div><div class="im">My problem is that I want to replace the some_geometry_data value by the result of the SELECT query. And of course I am not an expert user of SQL statements so I don't know how to do that..</div>
from my_street_table;</div><div>Maybe your example can work, I will try it later and let you know.<br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><div class="im">
INSERT INTO boundaries ( the_geom, the_name ) SELECT ST_ConvexHull(ST_Collect(the_geom)) as the_geom, 'mytablename' from my_street_table;</div></div></div></blockquote><div><div><br>Regards,</div><div><br><div class="gmail_quote">
On Wed, May 5, 2010 at 5:52 AM, Nicolas Ribot <span dir="ltr"><<a href="mailto:nicolas.ribot@gmail.com">nicolas.ribot@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 class="im">On 5 May 2010 02:38, Oscar Zamudio <<a href="mailto:cmntlk@gmail.com">cmntlk@gmail.com</a>> wrote:<br>
> Well, it works like a charm!<br>
> But I still need some advise. The query generates a polygon and I use astext<br>
> to get readable output. Now I create a new table that will contain a name<br>
> and the geometry result of the query. I want to use something like:<br>
> INSERT INTO boundaries ( the_geom, the_name ) VALUES (SELECT<br>
> ST_ConvexHull(ST_Collect(the_geom)) as the_geom from my_street_table),<br>
> 'mytablename');<br>
> This can't work but I don't know how to do it better.<br>
> By now I first returned the polygon as text and then did the following:<br>
> INSERT INTO boundaries ( the_geom, the_name ) VALUES<br>
> (ST_GeomFromText('POLYGON((-58.8714168974345<br>
> -34.5696042275729,-58.9620017725354 .......))'), 'mytablename');<br>
> With this and pgsql2shp I generated a shapefile for the boundary. I could<br>
> draw the streets (original shapefile) and the boundary both together and<br>
> they match perfect!<br>
> Please excuse me if I am making a silly question but I'm a newbie.<br>
> Thanks in advance<br>
><br>
<br>
</div>Hi,<br>
I'm not sure I understand your question.<br>
You want to find the INSERT syntax allowing to use a query to provide<br>
the table with values ?<br>
<br>
INSERT also accepts a query to get the values<br>
(<a href="http://www.postgresql.org/docs/8.4/static/sql-insert.html" target="_blank">http://www.postgresql.org/docs/8.4/static/sql-insert.html</a>):<br>
<div class="im"><br>
NSERT INTO boundaries ( the_geom, the_name )<br>
</div>SELECT ST_ConvexHull(ST_Collect(the_geom)) as the_geom, 'mytablename'<br>
from my_street_table;<br>
<font color="#888888"><br>
Nicolas<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
postgis-users mailing list<br>
<a 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>
</div></div></blockquote></div><br></div></div>