GeoPosition

I have posted up a link (look under the ‘Pages’ heading) to a javascript class I have written called GeoPosition. This will convert coordinates between OSGR and WGS84 formats. WGS84 is the format google maps uses to plot points.

Here you are.

Code fix – The function calculateZoomLevel will now set the zoom level correctly to the bounding box of the dataset points. Thanks DaveP.


function calculateZoomLevel(spanLng, spanLat)
{
var level = _zoomLevelsX.length-1;
var found = false;
var index = 0;

while (!found && index<_zoomlevelsx .length) { if (_zoomLevelsX[index]>spanLng && _zoomLevelsY[index]>spanLat)
{
level = index;
found = true;
}
index++;
}

return level;
}

The zoomLevelsX and Y arrays hold the span values for each of the zoom levels.

Comments

Leave a Reply