<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">Hi,</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">I have almost completed this task, but am stuck with the last bit.</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">....with the following code I can output the current map.getcenter coordinates to a hidden div called '<span class="Apple-style-span" style="font-size: small; ">centercoords</span>'. When the map is panned, the div is updated.</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif;
font-size: 10pt; "><br></div><div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><div>var centercoordsOutput = document.getElementById('centercoords');</div><div><br></div><div>function getMapCenter() {</div><div>var latlon =map.getCenter(); </div><div>centercoordsOutput.innerHTML = latlon;<span class="Apple-tab-span" style="white-space:pre">                                </span></div><div>return latlon </div><div>}</div><div><br></div><div> // update the bounds with each map move</div><div> map.events.register('moveend', map, getMapCenter);</div><div> // and update the bounds on first load</div><div> getMapCenter();</div></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font
class="Apple-style-span" face="arial, helvetica, sans-serif" size="2">....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</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> text:" - PDF Drucken",</div><div> icon: "../images/printer.png",</div><div> tooltip: {</div><div> title: "Export",</div><div> text: "Karte als PDF-Datei exportieren"</div><div>
},</div><div> handler: function () {</div><div> printsettings.show();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> pageLayer.setVisibility(true);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>// get contents of div</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> var getmapbounds = document.getElementById('centercoords').innerHTML;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>// assign content to textarea</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> var coordsbox = document.getElementById('coordstextarea');</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> coordstextarea.value=getmapbounds;<span class="Apple-tab-span"
style="white-space:pre">                                        </span> </div><div> }</div><div><br></div><div><br></div><div><br></div><div><br></div><div>This basically works as can be seen here....http://maps.zgb.de/lws.html but I still have a couple of challenges...</div><div><br></div><div>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.</div><div><br></div><div>2. The variable doesn´t get printed unless I set the textarea focus property to true.</div><div><br></div><div>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</div><div><br></div><div><br></div><div>If anyone can see any workarounds or ways to improve my code I would be most
grateful,</div><div><br></div><div>Yours,</div><div><br></div><div>Rob</div></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif" size="2"><br></font></div></div></div></body></html>