[OSM-dev] Addressable maps & updated URL?

Tom Hughes tom at compton.nu
Thu Oct 4 14:15:15 BST 2007


In message <4704E373.2000502 at skynet.be>
        Christophe Cattelain <xof at skynet.be> wrote:

> I did not find where I would modify the OSM sources (and wouldn' t dare
> to... ;-).

Well you won't be able to without svn commit access...

> 1/ In the code where lat, lon, zoom,...  is extracted from the URL. 
> Something like :
>
>>   query = location.search;
>
> has to be replaced by (something like)
>
>>    if ((pos = location.href.indexOf('#')) != -1)
>>                {
>>                url = location.href.substring(0, pos);
>>                var query = location.href.substring(pos+1);
>>                }
>>        else    {
>>                var query = location.search.substring(1);
>>                url = location.pathname;
>>                }

I have no idea what code this is you're talking about, or what you
think that change is going to achieve. I can't see the line you're
referring to anywhere in our code.

> 2/ in the 'moveend' handler,
> replace
>
>>    document.cookie = "location=" + lonlat.lon + "," + lonlat.lat + ","
> + zoom + "," + layers;
>
> by (something like)
>
>>    location.href =
> url+"#lat="+lonlat.lat.toFixed(6)+"&lon="+lonlat.lon.toFixed(6)+"&zoom="+zoom+"&layers="+layers;
>
> (0.000001 degree seems enough, no? (< 0.12 meter (?), 1 pixel @ zoom-12;
> but, true, 33 pixels @ zoom-17))

This is the only code that should need changing to implement your
suggestion. I've no idea why you want to faff about without rounding
the values though - we don't bother anywhere else.

> 3/ Get rid of the cookie mecanism.

No need to do that either, and it does some things which your
solution can't like remembering the last place you looked at the
next time you come back to the site.

> The advantages of the 'updated URL' are :
>     - there are no surprises when I refresh the page, I don't go to a
> (forgotten) place when I just want to go 'home',

The cookie solution already takes care of that in most cases (it can
get confused if you have multiple tabs open).

>     - I can have multiple views in different tabs.

Nothing to stop you doing that now. I often do it.

> What would be nice too, would be to 're-center' the view when we come
> back from the (potlatch) editor.

That has long been on the wish list, but it requires the author of
Potlatch to work out the intricacies of Flash <-> Javacript communication.

As soon as that is sorted out the position propagation (in both
directions) will be taken care of.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/




More information about the dev mailing list