Can you please explain the reasoning behind wanting to "refresh" the entire map? I can understand reloading individual layers via layer.redraw(), but reloading the entire map seems a bit odd and wasteful, to me, as far as bandwidth goes. Depending upon what you are doing it may simply be best to write your own function for triggering layer redrawing layers (no need to redraw static layers such as google maps) and then reset the zoom to the maximum or default extents. -- Nathan Gerber
On Sun, Aug 22, 2010 at 5:50 AM, geekjack <geekj...@163.com> wrote: > > Hi all: > As the Openlayers make the maps show in the DIV "map" at my pages. Now I > have a problem : > If I want the <div id="map"> refreshed only in my page,when I click a > button,what should I do to make it ? In my opinion : Ajax would be good to > solve the problem,but I just cannot make it right because of my unfamiliar > use of the Ajax. > I have made it by the codes below: > > <script tpe="text/JavaScript"> > function refdiv(){ > document.getElementById("map").innerHTML = ""; > init(); > } > > function init() { > > ... //codes here > > } > > </script> > > <body onload="init()"> > ... //codes > <div id="map"><div> > <input type="button" onclick="refdiv();" value="test"> > </body> > > It is not a good method ,because when click the button "test",the map would > be initialized,include the map center,the zoom-level... > But I can save data:the center,the level and other options,and after > clicking the button init the div,we can set the options base on the data > saved.and make it looks "refreshed" not "initialized"; > > But I still searching for a better method,can somebody help me? Thank you!! > > -- > View this message in context: > http://osgeo-org.1803224.n2.nabble.com/How-to-refresh-the-div-map-only-tp5449343p5449343.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > _______________________________________________ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users >
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users