[postgis-users] Newbie question about making points...

Nicolas Ribot nicky666 at gmail.com
Tue Oct 10 00:59:31 PDT 2006


On 10/10/06, Jonathan Greenberg <jgreenberg at arc.nasa.gov> wrote:
> So I have a postgres table with 5 fields, 2 of which are utm x and y
> coordinates -- I would like to start working with this table as a set of
> points, what are the steps I need to do to "convert" this to a "point"
> coverage?
>

Hello Jonathan,

I would do like this:
1°) Adding a new geometry column to my table:
alter table mytable add column geom geometry;

2°) Registering this geometric column into Postgis metadata tables:
select AddGeometryColumn('public', 'mytable', 'geom', <utm srid>, 'GEOMETRY', 2)

where <utm srid> is the SRID for the UTM zone you work in (see
spatial_ref_sys table for the list of SRS and their SRID)

3°) Populating the column with the makePoint() and setSRID functions:
update mytable set geom = setSRID(makePoint(UTM_x, UTM_y), <utm srid>));
(the setSRID will force the geometries' SRID to match the one defined
in the addGeometryColumn function

PS: registering the column and setting a correct SRID are optional,
but recommanded steps.

Nicolas



More information about the postgis-users mailing list