[GIS] Problems getting openlayers permalink working

openlayers-2

I set up an openlayers permalink function. I set the code and it shows up. But the URL does not work. Where is
I get a link like this:
http://babkart.no/?zoom=9&lat=7016094.01622&lon=121216.28057&layers=BFFFTTTTTF

The only thing that works is the chosen layers. It does not show the correct zoom or boundingbox. What do I need in the code to get this to work? I can not see I have any variables like "lat", "lon" or "zoom". Any examples as how to get this to work? I also would like to put the permalink in the toolbar so that one can copy the URL. I am using ExtJS 2.2.
But this is another issue and I have to get the permalink to work first.

I add the permalink like this:

controls: [new OpenLayers.Control.KeyboardDefaults(),new OpenLayers.Control.PanZoomBar(),new OpenLayers.Control.ScaleLine(),
                new OpenLayers.Control.Navigation(),new OpenLayers.Control.Permalink()]

My app.js is here if anyone wants to take a look:
http://pastebin.com/AstbpBWV
The site is running here: http://babkart.no/

~asle

I got this to work this way. Don't know if it was good or bad but it seems to work:
I use a function to zoom in to a location and added functionality to just zoom in to the view. I use the OpenLayers.Permalink() function.

        // If URL contains ref. to a location:
        var args = OpenLayers.Util.getParameters();
        if (args.x && args.y) {
            var position = new OpenLayers.LonLat(parseFloat(args.x), parseFloat(args.y));
            map.setCenter(position, 14);
            var xy = map.getViewPortPxFromLonLat(position);
            xy.x = Math.round(xy.x);
            xy.y = Math.round(xy.y);
            info.getInfoForClick({xy: xy});
        } // read the permalink URL
        else if (args.lat && args.lon && args.zoom) {
            var position = new OpenLayers.LonLat(parseFloat(args.lon), parseFloat(args.lat));
            map.setCenter(position, parseFloat(args.zoom));
        }
        else {
                map.setCenter(new OpenLayers.LonLat(528277, 7188837), 3);
        }

Best Answer

It looks like you use GeoExt. There is own permalink mechanism for using within GeoExt. See docs and example.