[postgis-users] creating points from polygons, storing all attributes

Hugues François hugues.francois at irstea.fr
Thu Jul 4 05:30:35 PDT 2019


Hi, 

Of course if you select * from a table where a column "the_geom" exists and perform in the same time some geometry computation with an alias named "the_geom" (i.e. "AS the_geom"), then you have two columns named "the_geom". 

Best regards, 
Hugues 




De: "paul malm" <paul.malm at lfv.se> 
À: "PostGIS Users Discussion" <postgis-users at lists.osgeo.org> 
Envoyé: Jeudi 4 Juillet 2019 14:26:07 
Objet: Re: [postgis-users] creating points from polygons, storing all attributes 



Thanks, I’ve tried that but get this error: 

ERROR: column "the_geom" is specified more than once SQL state: 42701 

/Paul 




Från: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] För Derek Watling 
Skickat: den 4 juli 2019 13:55 
Till: PostGIS Users Discussion 
Ämne: Re: [postgis-users] creating points from polygons, storing all attributes 




CREATE TABLE NewPointLayer AS SELECT *, ST_PointOnSurface(the_geom)::geometry(Point,32632) AS the_geom FROM OldPolygonLayer 




From: postgis-users <postgis-users-bounces at lists.osgeo.org> On Behalf Of paul.malm at lfv.se 
Sent: Thursday, 04 July 2019 13:47 
To: postgis-users at lists.osgeo.org 
Subject: [postgis-users] creating points from polygons, storing all attributes 




Hi, 

I would like to create a point table from a polygon table. One point in each polygon 

Query = CREATE TABLE NewPointLayer AS SELECT ST_PointOnSurface(the_geom)::geometry(Point,32632) AS the_geom FROM OldPolygonLayer 



But how do I write the query to get all the attributes from OldPolygonLayer to the NewPointLayer? 



Thanks in advance, 

Paul 





_______________________________________________ 
postgis-users mailing list 
postgis-users at lists.osgeo.org 
https://lists.osgeo.org/mailman/listinfo/postgis-users 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190704/7cf02853/attachment.html>


More information about the postgis-users mailing list