Обсуждение: Create GEOM Column

Поиск
Список
Период
Сортировка

Create GEOM Column

От
James Smith
Дата:
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

Re: Create GEOM Column

От
Mark Wimer
Дата:
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