[英]How do I refresh a TMS layer in OpenLayers?
I have a TMS layer that looks something like this: 我有一个TMS层,看起来像这样:
var v = 1;
my_tms = new OpenLayers.Layer.TMS(
"My TMS",
"my_mapserver.php?v="+my_var+"&",
{ transparent: 'true', type:'png', getURL:get_my_url }
);
Where my_mapserver.php returns map tiles according to the value of v. 其中my_mapserver.php根据v的值返回地图图块。
The app allows users to change v, and I simply want to refresh the my_tms layer, however, so far the only way I can get it to refresh is by destroying the map and recreating it. 该应用程序允许用户更改v,而我只是想刷新my_tms图层,但是,到目前为止,我可以刷新它的唯一方法是销毁地图并重新创建它。
I thought I could just do something like this: 我以为我可以做这样的事情:
v = 2;
my_tms = new OpenLayers.Layer.TMS(
"My TMS",
"my_mapserver.php?v="+my_var+"&",
{ transparent: 'true', type:'png', getURL:get_my_url }
);
my_tms.redraw();
However, these tiles are not getting requested when I redraw(). 但是,当我redraw()时,未要求这些磁贴。
Any help is appreciated. 任何帮助表示赞赏。
由于TMS图层是从Grid图层继承的,因此您可以尝试调用clearGrid()方法来删除所有现有的图块,然后再调用spiralTileLoad()来加载新的图块。
layer.redraw();
, OpenLayers.Strategy.Refresh
and clearGrid()
didn't help me in reloading tiles of OpenLayers.Layer.TMS
layer in OpenLayers 2.13.1, but helped: , OpenLayers.Strategy.Refresh
和clearGrid()
不能帮助我重新加载OpenLayers 2.13.1中的OpenLayers.Layer.TMS
层的图块,但可以帮助:
layer.mergeNewParams({});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.