[OSM-dev] Projection problems

Bradley Kite bradley.kite at gmail.com
Tue Dec 16 16:56:20 GMT 2008


Hi all,

I wonder if any one could be so kind as to help me out with a problem
I am having with projections:

I am trying to convert from lat/long coords to the Mercator projection
as is used in osm2pgsql

I am using this code:

http://wiki.openstreetmap.org/index.php/Mercator#Java_Implementation

The Lat/Long I am using is (bounding box around a street I know):

-0.90362548828125,51.38892310050485 to -0.90087890625,51.38720911696496

However, when converted to Mercator projection as per the above Java
code, I get the following:

-100591.12922329194,6656970.686752424 to -100285.38111015123,6656665.738991335

The y values (6656970 - 6656665) do not match up with data the
postgres database:

LINESTRING(-100491.52 6690303.05,-100474.32 6690280.11,-100456.16
6690259.1,-100438.02 6690235.21,-100434.02 6690222.73,-100430.37
6690211.33,-100433.23 6690176.94,-100434.19 6690146.36,-100432.48
6690134,-100430.37 6690118.64,-100417.95 6690093.81,-100398.83
6690072.78,-100373.27 6690047.38,-100370.16 6690038.6,-100327.34
6689918.14,-100309.98 6689869.27,-100245.01 6689884.55)

Note - all the Y values in the DB are ~6690000 not ~6650000 as
returned by the mercY() function.

The effect of this is that an SQL query to pull data from the database
is not fetching the correct data.

Would there happen to be an expert on this list that help out with the
accuracy of the projection code at the above link? It only affects the
Y coordinate, X seems fine.

Many thanks in advance.

--
Brad.




More information about the dev mailing list