[OSM-dev] Openlayers cyclemap permalinks

Dave Stubbs osm.list at randomjunk.co.uk
Mon May 19 11:01:48 BST 2008

On Mon, May 19, 2008 at 10:17 AM, Andy Allan <gravitystorm at gmail.com> wrote:
> On Sat, May 17, 2008 at 11:51 PM, Thomas Wood
> <grand.edgemaster at gmail.com> wrote:
>> 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
>> if:
>> 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)
> Wow, cheers for this.
> As for the other replies - it wasn't something I'd ever thought of
> when setting it up originally, but the next version of the map had
> this "fixed" (using the new openlayers). What I'd be very interested
> in is a little php script which takes the old style URLs and throws a
> 301 to a different URL with new-style urls after having done some
> maths.

you mean something like this?

(only converts lon,lats where the values lie outside the range -180,180,-90,90)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check.php
Type: application/x-httpd-php
Size: 658 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20080519/c1745fdd/attachment.php>

More information about the dev mailing list