[postgis-users] Appending geometry data from another table
Michael Fuhr
mike at fuhr.org
Fri Oct 20 21:31:44 PDT 2006
On Fri, Oct 20, 2006 at 08:01:41PM -0600, Bruce Rindahl wrote:
> Thanks for the hint. After testing I got the final solution:
> INSERT into county_parcels SELECT
> 'Archuleta' as county,
> cast(GeomFromText(asText(the_geom),26913) as geometry) as the_geom
> FROM county_temp;
>
> I needed to cast the result as a geometry type and specify the SRID for the
> constraint on the table.
GeomFromText() returns a geometry type; the cast shouldn't be necessary.
> If there is a cleaner solution I would love to hear it.
If county_temp.the_geom is a geometry and if you don't need to
transform the coordinates then you could use SetSRID():
INSERT INTO county_parcels
SELECT 'Archuleta', SetSRID(the_geom, 26913)
FROM county_temp;
--
Michael Fuhr
More information about the postgis-users
mailing list