[OSM-dev] Too many decimal places in permalinks

John McKerrell john at mckerrell.net
Tue Oct 23 11:36:59 BST 2007


On 23 Oct 2007, at 11:14, Tom Hughes wrote:

> In message <739E7C03-69D1-49BF-A519-A353C6A99060 at mckerrell.net>
>         John McKerrell <john at mckerrell.net> wrote:
>
>> On 23 Oct 2007, at 10:25, Tom Hughes wrote:
>>
>>> In message <4714CFF7.1080000 at arjam.net>
>>>         Robert Munro <rjmunro at arjam.net> wrote:
>>>
>>>> I noticed the other day that the permalinks on the view tab of
>>>> www.openstreetmap.org have way more decimal places than is useful.
>>>>
>>>> Below is a little (untested) patch to site.js that should make the
>>>> links
>>>> much shorter. It rounds the numbers to the (current zoom level)/3
>>>> decimal places, which at zoom level 2 (the worst case) is  
>>>> accurate to
>>>> less than 3 pixels - zoom level 2 is:
>>>>  (1024 pixels wide)/(360 degrees)= 2.8 pixels/degree.
>>>
>>> Applied and deployed.
>>
>> Hi, I'd suggest not linking this to zoom level as you may find that
>> when you click on a link you've copied (perhaps after zooming out a
>> few times), and then zoom in, you end up somewhere you don't expect
>> to be due to the rounding. I'd suggest just rounding to 5 decimal
>> places should be fine for our purposes at all zoom factors (sorry,
>> patch not provided but should be fairly simple).
>
> I don't understand... As things stand any link you take should
> position you within three pixels of the original position when
> you go back to it so you should then get essentially the same as
> the other person would have when zooming in surely?

That's within 3 pixels of the position at zoom factor 2 though.  
Actually as I try it out I see that I'm having to push it to get  
something bad, e.g., "here's a map of Lime Street Station in  
Liverpool, I've zoomed out a bit to give you some context but zoom in  
and you'll see where it is":

http://www.openstreetmap.org/?lat=53.41&lon=-2.98&zoom=6&layers=B0T

As you see, I had to zoom out quite far to get it to break by not  
very much, but I'd argue it's not worth losing the accuracy anyway,  
there might be more problematic cases I'm not thinking of (e.g., if I  
copied the lat/lon fields from that link to get a marker, the marker  
would then be off).

John




More information about the dev mailing list