[postgis-users] converting to lat long

pcreso at pcreso.com pcreso at pcreso.com
Fri Oct 15 13:14:17 PDT 2010


Not quite.

You need to reproject the lat long coords to 29101 before writing them to your table.

Your first SQL creating the column is fine, the second update needs changing.

UPDATE tablename SET geom_col = st_transform(st_setsrid(makepoint(long_dd,lat_dd),4326),29101);

this:
creates a point from two numbers (makepoint)
sets this to lat/long (setsrid to 4326)
reprojects to 29101 (st_transform to 29101)
updates each gem_col with this value


Cheers,

  Brent
 
--- On Sat, 7/16/11, Yamini Singh <yaminijsingh at live.com> wrote:

From: Yamini Singh <yaminijsingh at live.com>
Subject: RE: [postgis-users] converting to lat long
To: pcreso at pcreso.com
Date: Saturday, July 16, 2011, 5:39 AM





Yes Bret, at-least on the same topic i can do that for novices ....

Now i have 'geom'  column with SRID 4326 generated from two columns  'lat_dd' and 'long_dd' which since i dont know how to convert individual column lat_dd and long_dd to SRID 29101 i use query to directly generate geometry.First i create geometry column using: 
SELECT addgeometrycolumn('tablename', 'geom_col', '29101', 'POINT', 2);
then i generate geometry directly using sql below (if i understand correctly that if the geometry col (i.e., geom_col) is set to SRID 29101 then even if i use lat_dd and long_dd i should get geometry which is as per the SRID 29101 and not 4326)
UPDATE tablename SET geom_col = st_setsrid(makepoint(long_dd,lat_dd),29101);

hope this is correct.

Regards,YJ




Date: Thu, 14 Jul 2011 23:54:48 -0700
From: pcreso at pcreso.com
Subject: RE: [postgis-users] converting to lat long
To: yaminijsingh at live.com


You are welcome :-)

Your turn to help other newcomers as they ask questions you can answer!

Cheers,

Brent




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


More information about the postgis-users mailing list