Guest User

Untitled

a guest
Oct 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. wmtsLayer.dispatchChangeEvent(); // Method 1
  2.  
  3. wmtsLayer.getSource().dispatchChangeEvent(); // 2
  4.  
  5. wmtsLayer.getSource().updateParams({"time": Date.now()}); // 3
  6.  
  7. wmtsLayer.getSource().changed(); // 4
  8.  
  9. map.updateSize(); // 5
  10.  
  11. wmtsLayer.getSource().refresh(); // 6
  12.  
  13. // 7:
  14. var source = wmtsLayer.getSource();
  15. source.tileCache.expireCache({});
  16. source.tileCache.clear();
  17. source.refresh();
  18.  
  19. // 8 (deleting the layer and making a new one):
  20. map.removeLayer(wmtsLayer);
  21. fetch(WMTS_URL + "&time="+ new Date().getTime()).then(function(response) {
  22. return response.text();
  23. }).then(function(text) {
  24. var result = parser.read(text);
  25. var options = optionsFromCapabilities(result, {
  26. layer: FULL_LAYER_NAME,
  27. matrixSet: SRS_NAME
  28. });
  29.  
  30. wmtsLayer = new TileLayer({
  31. opacity: 1,
  32. source: new WMTS((options))
  33. });
  34. map.addLayer(wmtsLayer);
  35. });
Add Comment
Please, Sign In to add comment