[OSM-dev] Openlayers cyclemap permalinks

Thomas Wood grand.edgemaster at gmail.com
Sat May 17 23:51:33 BST 2008

On Sat, 2008-05-17 at 21:47 +0100, OJ W wrote:
> The cycle map seems to have the openlayers permalink bug [1] - is it
> possible to apply the latest openlayers corrections so that it uses
> lat/long in permalinks?
> Can someone from OL also reply to this, saying how to do the correction?
> [1] http://www.gravitystorm.co.uk/osm/?zoom=13&lat=6781599.86453&lon=-126905.18782&layers=B00
> 6781599 degrees north is not the usual way of representing positions
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev

As noted on IRC, this is not a bug, but a raw expression of the way we
make our tiles, the numbers represent the distance in meters from the
origin. I guess they're not strictly lats and lons, but its just OL's
terms for the permalink.

Attached is a modified copy of the map.js used on gravitystorm.co.uk
which uses the projection features in OpenLayers 2.6, it sets
displayProjection to fix the bug, and changes the existing reprojection
functions to be wrappers around the OL code.

It should just slot in, but is untested. It should also handle the
existing permalinks semi-intelligently, assuming they're the old format
a) The OL permalink control puts the position outside of the map's
maxExtent (ie: sets centre to 0,0)
b) lat, lon, zoom params are numbers (checked to be outside the expected
range for lat lons)

Hope this helps,
Thomas Wood
-------------- next part --------------
A non-text attachment was scrubbed...
Name: map.js
Type: application/javascript
Size: 2890 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20080517/43b904c1/attachment.js>

More information about the dev mailing list