Re: Create GEOM Column - Mailing list pgsql-novice

From Mark Wimer
Subject Re: Create GEOM Column
Date
Msg-id OFC0DA7B13.693CD022-ON852578A1.005A7D41-852578A1.005CEB51@usgs.gov
Whole thread Raw
In response to Create GEOM Column  (James Smith <james.david.smith@gmail.com>)
List pgsql-novice
Hi James,

Put in the correct schema name below if it isn't public; and you may need to quote your lat/lon field names if they're really capitalized ( i.e. "Latitude", "Longitude"). This should work...  

SELECT AddGeometryColumn(
       'public',                       --schema
       'CAMDENGPS',                      --tablename
       'the_geom',                     --field to contain geom
       4326,                           --srid from spatial_ref_sys
       'POINT',                        --type of geometry
       2                               --dimensions, 1 didn't work.
 );

Then...

UPDATE public."CAMDENGPS"
SET the_geom = ST_SetSRID(ST_Point(longitude, latitude),4326);



Mark


From:James Smith <james.david.smith@gmail.com>
To:pgsql-novice@postgresql.org
Date:05/29/2011 04:31 PM
Subject:[NOVICE] Create GEOM Column
Sent by:pgsql-novice-owner@postgresql.org





Dear all,

Would appreciate some help. I have created an existing database (with
PostGIS extension) andhas a table called CAMDENGPS which is populated
with approx 600,000 rows. There are 20 or so columns in the table, two
of which are Latitude and Longitude (WGS84). I would now like to
create a Geom column with points in, the values of which should be
taken from the other columns. Could someone provide me with sample
code as to how to do this please?

Thank you

James

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice


pgsql-novice by date:

Previous
From: "Jean-Yves F. Barbier"
Date:
Subject: Re: indexes multicolumn
Next
From: "Jean-Yves F. Barbier"
Date:
Subject: BYTEA or LO?