[OSM-dev] two javascript challenges for enthusiastic hackers

John McKerrell john at mckerrell.net
Thu May 17 14:09:18 BST 2007


Hi Nick (Black)

I actually noticed something like this while working on the accounts  
page but I could never track it down. I think it's actually more a  
problem with open layers not reporting the correct position than your  
conversion being wrong though. You might want to just try modifying  
the HTML a bit and seeing if you get different results, ISTR it was  
quite sporadic though, the same HTML/CSS could work some times and  
not at others. Actually, you haven't got a doctype on your page so  
that would be a good start...

John


On 17 May 2007, at 12:22, Nick Whitelegg wrote:

> Hello Nick,
>
> For the Mercator stuff you might want to use my pre-written class,  
> which
> itself borrowed the conversion off OSM and some articles on the  
> intenet
> (i.e. not really sure how the maths works - but it gives the right
> answer):
>
> http://www.free-map.org.uk/freemap/javascript/converter.js
>
> Remove the "case OSGB" blocks in the switch statements as they  
> depend on
> another library.
>
> To use:
>
> var cvtr = new converter("Mercator");
> var normLL = new OpenLayers.LonLat(...,...);
> var merc = cvtr.normToCustom(normLL);
>
> or
>
> var cvtr = new converter("Mercator");
> var mercLL = new OpenLayers.LonLat(...,...);
> var normal = cvtr.customToNorm(mercLL);
>
> Nick
>
>
>
>
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev





More information about the dev mailing list