[OSM-talk] OSM2PQSQL / PostGis: Coordinate Conversion

Jon Burgess jburgess777 at googlemail.com
Sun Feb 21 13:28:39 GMT 2010


On Fri, 2010-02-19 at 08:19 -0800, d8930 wrote:
> Hi,
> I am working on this as well. However, for testing I am using a point that
> lies in the German city of Wiesbaden-Naurod. This city has the
> geocoordinates 8.301388 / 50.13472. When I transform it by
> SELECT astext(ST_Transform(ST_SetSRID(ST_MakePoint(8.301388,50.13472),
> 4326), 900913))
> I get the value POINT(924106.285037392 6469639.74359406), which pretty much
> is the same as the value in my PostGIS-DB (that was fed from OSM):
> 646985238;92409686 (considering multiplication by 100).
> However, the other way round, with 
> SELECT
> astext(ST_Transform(ST_SetSRID(ST_MakePoint(92409686/100,646985238/100),
> 900913), 4326))")
> I get the strange result POINT(1.30152356525693e-06 7.86059348425535e-06)
> instead of somethin with 8.3* and 50.1*.
> Any idea, why this could be?

It works for me, though there was an extra ") in what you quoted.

gis=> select astext(ST_Transform(ST_SetSRID(ST_MakePoint(92409686/100,646985238/100),900913), 4326));
                 astext                  
-----------------------------------------
 POINT(8.30129560793713 50.135942170124)
(1 row)

You will get slightly better accuracy if you divide by 100.0 to force
the result to be calculated as a float:

gis=> select astext(ST_Transform(ST_SetSRID(ST_MakePoint(92409686/100.0,646985238/100.0),900913), 4326));
                 astext                  
-----------------------------------------
 POINT(8.30130333344857 50.135944358132)
(1 row)


	Jon







More information about the talk mailing list