[postgis-users] Need a "polygon box" of a table instead of the bounding box that returns extent function
cmntlk at gmail.com
Wed May 5 07:14:58 PDT 2010
What I want to do is an insert of the type INSERT INTO...VALUES .. as
INSERT INTO boundaries ( the_geom, the_name ) VALUES
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..
Maybe your example can work, I will try it later and let you know.
INSERT INTO boundaries ( the_geom, the_name ) SELECT
ST_ConvexHull(ST_Collect(the_geom)) as the_geom, 'mytablename' from
On Wed, May 5, 2010 at 5:52 AM, Nicolas Ribot <nicolas.ribot at gmail.com>wrote:
> On 5 May 2010 02:38, Oscar Zamudio <cmntlk at gmail.com> wrote:
> > Well, it works like a charm!
> > But I still need some advise. The query generates a polygon and I use
> > to get readable output. Now I create a new table that will contain a name
> > and the geometry result of the query. I want to use something like:
> > INSERT INTO boundaries ( the_geom, the_name ) VALUES (SELECT
> > ST_ConvexHull(ST_Collect(the_geom)) as the_geom from my_street_table),
> > 'mytablename');
> > This can't work but I don't know how to do it better.
> > By now I first returned the polygon as text and then did the following:
> > INSERT INTO boundaries ( the_geom, the_name ) VALUES
> > (ST_GeomFromText('POLYGON((-58.8714168974345
> > -34.5696042275729,-58.9620017725354 .......))'), 'mytablename');
> > With this and pgsql2shp I generated a shapefile for the boundary. I could
> > draw the streets (original shapefile) and the boundary both together and
> > they match perfect!
> > Please excuse me if I am making a silly question but I'm a newbie.
> > Thanks in advance
> I'm not sure I understand your question.
> You want to find the INSERT syntax allowing to use a query to provide
> the table with values ?
> INSERT also accepts a query to get the values
> NSERT INTO boundaries ( the_geom, the_name )
> SELECT ST_ConvexHull(ST_Collect(the_geom)) as the_geom, 'mytablename'
> from my_street_table;
> postgis-users mailing list
> postgis-users at postgis.refractions.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the postgis-users