OGC_wmtsLayer.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_wmtsLayer"></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" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
  14. <script type="text/javascript">
  15. var map, layer,
  16. host = window.isLocal ? window.server : "https://iserver.supermap.io";
  17. url = host + "/iserver/services/map-world/wmts100";
  18. map = new SuperMap.Map("map", {
  19. controls: [
  20. new SuperMap.Control.ScaleLine(),
  21. new SuperMap.Control.Zoom(),
  22. new SuperMap.Control.Navigation({
  23. dragPanOptions: {
  24. enableKinetic: true
  25. }
  26. })]
  27. });
  28. //wmts或许所需要的matrixID信息
  29. var matrixIds = [];
  30. for (var i = 0; i < 22; ++i) {
  31. matrixIds[i] = {identifier: i};
  32. }
  33. ;
  34. //当前图层的分辨率数组信息,和matrixIds一样,需要用户从wmts服务获取并明确设置,resolutions数组和matrixIds数组长度相同
  35. var resolutions = [1.25764139776733, 0.628820698883665, 0.251528279553466,
  36. 0.125764139776733, 0.0628820698883665, 0.0251528279553466,
  37. 0.0125764139776733, 0.00628820698883665, 0.00251528279553466,
  38. 0.00125764139776733, 0.000628820698883665, 0.000251528279553466,
  39. 0.000125764139776733, 0.0000628820698883665, 0.0000251528279553466,
  40. 0.0000125764139776733, 0.00000628820698883665, 0.00000251528279553466,
  41. 0.00000125764139776733, 0.000000628820698883665, 0.000000251528279553466];
  42. //新建图层
  43. layer = new SuperMap.Layer.WMTS({
  44. name: "World",
  45. url: url,
  46. layer: "World",
  47. style: "default",
  48. matrixSet: "GlobalCRS84Scale_World",
  49. format: "image/png",
  50. resolutions: resolutions,
  51. matrixIds: matrixIds,
  52. opacity: 1,
  53. requestEncoding: "KVP"
  54. });
  55. //图层添加并显示指定级别
  56. map.addLayers([layer]);
  57. map.setCenter(new SuperMap.LonLat(0, 0), 2);
  58. </script>
  59. </body>
  60. </html>