[OSM-dev] two javascript challenges for enthusiastic hackers

Nick Whitelegg Nick.Whitelegg at solent.ac.uk
Thu May 17 12:22:22 BST 2007


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








More information about the dev mailing list