map_dynamiclayers.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  8. <title data-i18n="resources.title_dynamiclayers"></title>
  9. <script type="text/javascript" src="../js/include-web.js"></script>
  10. </head>
  11. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
  12. <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
  13. <script type="text/javascript" src="../../dist/classic/include-classic.js"></script>
  14. <script type="text/javascript">
  15. var map, layer, host = window.isLocal ? window.server : "https://iserver.supermap.io";
  16. url = host + "/iserver/services/map-world/rest/maps/World";
  17. map = new SuperMap.Map("map", {
  18. controls: [
  19. new SuperMap.Control.Navigation(),
  20. new SuperMap.Control.Zoom()]
  21. });
  22. layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, {
  23. transparent: true,
  24. cacheEnabled: true
  25. }, {
  26. dpi: 95.99999999999939,
  27. resolutions: [
  28. 0.34615384615384615, 0.17307692307692307,
  29. 0.08653846153846154, 0.04326923076923077,
  30. 0.021634615384615384, 0.010817307692307692,
  31. 0.005408653846153846, 0.002704326923076923,
  32. 0.0013521634615384615, 0.0006760817307692308,
  33. 0.0003380408653846154, 0.0001690204326923077,
  34. 0.00008451021634615384, 0.00004225510817307692,
  35. 0.00002112755408653846, 0.00001056377704326923
  36. ]
  37. });
  38. //监听图层信息加载完成事件
  39. layer.events.on({"layerInitialized": addLayer});
  40. function addLayer() {
  41. map.addLayer(layer);
  42. map.setCenter(new SuperMap.LonLat(0, 0), 1.5);
  43. }
  44. </script>
  45. </body>
  46. </html>