/*** Force particular WMS layer to refresh.* This code snippet is using internal API and private variables and should not be considered as a part of the Portal API.* Use at your own risk.* 2016-12-09 Piotr Szrajber <piotr.szrajber@hexagongeospatial.com>*/// find the topmost layer - replace it with the code that actually finds your WMS layer// TODO: make sure that it is a WMS layervarml=$mapStateManager.findMapState("map").get_mapControl().get_mapLayers().slice(-1)[0];// preparation on a selected WMS layer// the actual image reload would be prevented by browser cache, so I am appending some garbage to the URL. Some WMS services don't handle itvarorig=ml.getURL;ml.getURL=function(bounds){returnorig.call(this,bounds)+this._forceRedraw?"&foo="+(newDate()).getTime():""};// call it when you need to refresh the layerfunctionreloadMyWmsLayer(){ml._isDirty=ml._forceRedraw=true;ml._render();}// actual execution in your codereloadMyWmsLayer();
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.