Hi,

I have almost completed this task, but am stuck with the last bit.

....with the following code I can output the current map.getcenter coordinates 
to a hidden div called  'centercoords'. When the map is panned, the div is 
updated.


var centercoordsOutput = document.getElementById('centercoords');

function getMapCenter() {
var latlon =map.getCenter(); 
centercoordsOutput.innerHTML = latlon;
return latlon 
}

      // update the bounds with each map move
      map.events.register('moveend', map, getMapCenter);
      // and update the bounds on first load
      getMapCenter();


....I then use the innerHTML of the hidden div 'centercoords' to enter the 
latlon center coords into a textarea in my printpreview window which in turn 
will print them on the map by defining the variable in config.yaml

{
    text:" - PDF Drucken",
            icon: "../images/printer.png",
            tooltip: {
                title: "Export",
                text: "Karte als PDF-Datei exportieren"
            },
            handler: function () {
               printsettings.show();
   pageLayer.setVisibility(true);
// get contents of div
   var getmapbounds = document.getElementById('centercoords').innerHTML;
// assign content to textarea
   var coordsbox = document.getElementById('coordstextarea');
   coordstextarea.value=getmapbounds;   
            }




This basically works as can be seen here....http://maps.zgb.de/lws.html but I 
still have a couple of challenges...

1. once the print window is shown, the mapcenter coordinates are not updated 
anymore, so if I then pan the map, the mapcenter coordinates will be wrong.

2. The variable doesn´t get printed unless I set the textarea focus property to 
true.

3. I have to set a variable in config.yaml for the coordinates. This means 
other apps which do not have this variable now get an error and do not print


If anyone can see any workarounds or ways to improve my code I would be most 
grateful,

Yours,

Rob
_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to