[postgis-users] How to store coordinates correctly

Andy Anderson aanderson at amherst.edu
Mon May 26 20:41:54 PDT 2008


> 2008/5/27 MaRcELo PeReiRa <marcelops.stuff at gmail.com>:
> Hi there,
>
> It's my first post in this list, and here is my first question:
>
> Which is the correct way to store in a table some geografic  
> coordinates???
>
> I have a point:
> - S 22º 04' 2,5''
> - W 46º 50' 34,9''
>
> How can I store it??? Should I convert it??
>
> Thanks in advance,
> Marcelo / Brasil


On May 26, 2008, at 10:37 PM, Mark Leslie wrote:
> Try something along the lines of:
>
> CREATE TABLE points (id SERIAL);
> SELECT addGeometryColumn('points', 'the_geom', 4326, 'POINT', 2);
> INSERT INTO points (the_geom) VALUES (setSRID(geomFromText('POINT('  
> || (46 + 50/60.0 + 34.9/360.0) || ' ' || -(22 + 4/60.0 + 2.5/360.0)  
> || ')'), 4326));
> SELECT id, asText(the_geom) FROM points;

I'll warn that SRID = 4326 refers to one set of geographic  
coordinates, based on the WGS84 datum, but there are others, so make  
sure you know which one your data refers to. 0.1" ~ 10 m, a shift I've  
seen when changing a datum.

Cheers,

-- Andy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080526/48d01915/attachment.html>


More information about the postgis-users mailing list