[postgis-users] How to store coordinates correctly

Mark Leslie mrk.leslie at gmail.com
Mon May 26 19:37:02 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
>
> --
> People are very open-minded about new things - as long as they're exactly
> like the old ones.
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
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;


-- 
Mark Leslie
Geospatial Software Architect
LISAsoft
http://www.lisasoft.com/LISAsoft/SupportedProducts.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080527/f3a55f62/attachment.html>


More information about the postgis-users mailing list