[postgis-users] The_geom from default

Bruce Rindahl rindahl at lrcwe.com
Thu May 10 08:26:27 PDT 2007


Steve
Use a Trigger Function.  Look at the Postgresql documentation on how to do
this.
The query it will use is something like:
update my_table set the_geom =
transform(setSRID(MakePoint(lon,lat),4326),my_SRID)

where my_table is your table and my_SRID is the SRID of your table.

Bruce Rindahl

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Stephen
Crawford
Sent: Thursday, May 10, 2007 9:08 AM
To: 'PostGIS Users Discussion'
Subject: [postgis-users] The_geom from default

All,

Can 'the_geom' in a spatial table be set to a default to create the geometry
from the 'lat' and 'lon' columns?  I have table of farms as points that will
be updated occasionally; what I hope to achieve is that when a farm record
is added with lat and lon, the 'the_geom' field will automatically be
populated on insert.  Any good ideas on how to do this?

Thanks,
Steve

Stephen Crawford
Center for Environmental Informatics
GeoVISTA Center
The Pennsylvania State University



_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users






More information about the postgis-users mailing list