[postgis-users] E-N to Long Lat

pcreso at pcreso.com pcreso at pcreso.com
Sat Feb 12 00:05:16 PST 2011


Hi Ravi,

Sounds like you are dealing with point features, with a single coordinate pair. So if that is case this should help.

If you know the coordinate system they are in, you can tell Postgis to use that & transform the points to a lat/long geometry, as below. Posdtgis cannot detect a coordinate system, it generally needs to be told what the coordinate system is, unless the values are already geometries with a defined SRID. In which case you cal either 
\d <table> & note the the value set for the ST_srid() constraint, or you can try:
select ST_srid(geom) from table limit 1;

Given a table called tab with columns E & N, in a projection with SRID of 1234 (for example)

To create the geometry column:
select ST_AddGeometryColumn('','tab','geom',4326,'POINT',2);

To populate it:
update tab set
 geom=ST_Transform(ST_Setsrid(ST_Makepoint(E, N), 1234), 4326);

What this does is: make a point geometry from your E/N values, set this to the appropriate projection, convert the coordinates to lat/lon/WGS84 (SRID=4326) and set the geom value for each record to the result.

To find the SRID for your E/N coordinate system your E/N values are in, I suggest you visit:
http://www.spatialreference.org/ 

to find the EPSG code, which is generally the SRID used by Postgis to identify a projection.

HTH,

  Brent Wood



--- On Sat, 2/12/11, Ravi <ravivundavalli at yahoo.com> wrote:

From: Ravi <ravivundavalli at yahoo.com>
Subject: [postgis-users] E-N to Long Lat
To: "postgis" <postgis-users at postgis.refractions.net>
Date: Saturday, February 12, 2011, 7:35 PM

Got a data base of Eastings and Northings
which is the simplest way to
     1. Detect the projection, as I know where they belong
     2. Turn the table (in PostGIS) to Long Lat 
Ravi


-----Inline Attachment Follows-----

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110212/7d785d96/attachment.html>


More information about the postgis-users mailing list