[OSM-talk] OSM2PQSQL / PostGis: Coordinate Conversion

Jon Burgess jburgess777 at googlemail.com
Wed Jan 13 20:39:20 GMT 2010


On Wed, 2010-01-13 at 22:45 +0300, Alexander Menk wrote:
> Hi!
> 
> how can I translate the coordinate from the database to "normal" GPS 
> coordinates as they are used by OpenLayers etc.
> 
> 
> SELECT ST_Transform(lat,4326) FROM planet_osm_nodes
> 
> ERROR:  function st_transform(double precision, integer) does not exist

Something like this should work:

select
astext(ST_Transform(ST_SetSRID(ST_MakePoint(lon/100,lat/100),900913),4326)) from planet_osm_nodes;

                   astext
--------------------------------------------
 POINT(-0.233660788552329 51.6420473016351)
 POINT(-0.323177906614839 51.6455034823677)
 POINT(-0.490731673408812 51.6320228876355)
 POINT(-0.415551667280849 51.6282701316099)


Alternatively you may find it easier if you import the data with the
--latlong switch.


	Jon






More information about the talk mailing list