Skip site navigation (1) Skip section navigation (2)

Re: Create GEOM Column

From: Mark Wimer <mwimer(at)usgs(dot)gov>
To: James Smith <james(dot)david(dot)smith(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Create GEOM Column
Date: 2011-05-31 16:54:55
Message-ID: OFC0DA7B13.693CD022-ON852578A1.005A7D41-852578A1.005CEB51@usgs.gov (view raw or flat)
Thread:
Lists: 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(dot)david(dot)smith(at)gmail(dot)com>
To:
pgsql-novice(at)postgresql(dot)org
Date:
05/29/2011 04:31 PM
Subject:
[NOVICE] Create GEOM Column
Sent by:
pgsql-novice-owner(at)postgresql(dot)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

In response to

pgsql-novice by date

Next:From: Jean-Yves F. BarbierDate: 2011-05-31 17:09:23
Subject: BYTEA or LO?
Previous:From: Jean-Yves F. BarbierDate: 2011-05-31 14:30:47
Subject: Re: indexes multicolumn

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group