[OSM-dev] Projection calculation

Milo van der Linden mlinden at zeelandnet.nl
Mon May 19 22:08:35 BST 2008


Hello Wayne!

There is no "easy" way for doing coordinate transformations since there 
is a lot you have to take into account. I am not sure what programming 
language you want to use, but if it is Javascript you might dive into 
proj4js http://proj4js.org/ and see if it offers libraries you can use.

Good luck,

Milo van der Linden

Wayne Walker wrote:
> I'm not using slippy map.  For the project I'm doing I need static
> images.  I just can't sort out the math to find the veritcal position in
> the tile map.  I've tried mercator projection but I'm missing something.
>
> I've tried to follow the logic in the javascript of the slippy map, but
> without comments and with short var/function names I get lost.
>
> Does anyone have a simple formula such that:
>
> y = ....(lat)?
>
> I've tried things like:
>
> k = 4.0
> y = log(tan(y*Math::PI/180.0) + 1/cos(y*Math::PI/180.0))/k
>
> Which is the mercator projection formula (substituting 1/cos for sec)
> from wikipedia.
>
> Also tried a Miller cylindrical projection as that seems much more like
> what the main tile looks like.
>
> miller=2.30341254337639                                                                                                                                     
> y = 1.25 * log(tan(Math::PI/4 + 0.8 * (y*Math::PI/180.0)/2))/miller                                                                                         
>
>
> No joy there either.
>
> Any ideas?
>
>   





More information about the dev mailing list