[OpenLayers-Users] Looking to refresh a MapServer layer. . . .

Stephen Woodbridge woodbri at swoodbridge.com
Mon Mar 26 23:42:04 EDT 2012


Bob,

have your tried:

layer.redraw();

-Steve

On 3/26/2012 6:05 PM, Bob Basques wrote:
> I have tried this (last). I can't get it to reload anything. I tried a
> few different approaches, Help!! NOTE: Map displays fine on load, just
> won't refresh automatically at any interval. Thanks :
>
>
> var mslayer6 = new OpenLayers.Layer.MapServer( "<br /><img src=\"
> /http://gis.ci.stpaul.mn.us/datasets/DB/SAINT_PAUL/PUBLIC_WORKS/AVL/STREETS/plots_last_public.map?mode=legend/
> <http://gis.ci.stpaul.mn.us/datasets/DB/SAINT_PAUL/PUBLIC_WORKS/AVL/STREETS/plots_last_public.map?mode=legend>
> \">",
>
> "
> /http://gis.ci.stpaul.mn.us/datasets/DB/SAINT_PAUL/PUBLIC_WORKS/AVL/STREETS/plots_last_public.map?/
> <http://gis.ci.stpaul.mn.us/datasets/DB/SAINT_PAUL/PUBLIC_WORKS/AVL/STREETS/plots_last_public.map?>
> ",
>
> {layers: '',
>
> format: "image/png",
>
> transparent: "true"},
>
>
> {singleTile: "true",
>
> transitionEffect: 'resize',
>
> ratio: 1,
>
> displayInLayerSwitcher:'false'}
>
> );
>
>
> function init() {
>
>
> . . . some other stuff . . .
>
>
> window.setInterval(refreshData, 5000, mslayer6);
>
>
> } // END init
>
>
> function refreshData(layer){
>
> //setting loaded to false unloads the layer//
>
> layer.loaded = true;
>
> //setting visibility to true forces a reload of the layer//
>
> layer.setVisibility(true);
>
> //the refresh will force it to get the new KML data//
>
> layer.setUrl('http://gis.ci.stpaul.mn.us/datasets/DB/SAINT_PAUL/PUBLIC_WORKS/AVL/STREETS/plots_last_public.map?');
>
>
> }
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list