mvtVectorTile_restdata.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
  6. <title data-i18n="resources.title_mvtVectorLayer_restdata"></title>
  7. <script type="text/javascript" src="../js/include-web.js"></script>
  8. <style>
  9. body {
  10. margin: 0;
  11. padding: 0;
  12. }
  13. #map {
  14. position: absolute;
  15. top: 0;
  16. bottom: 0;
  17. width: 100%;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <div id="map" style="width: 100%; height: 100%; z-index: 0; position: absolute"></div>
  23. <script
  24. type="text/javascript"
  25. include="mapbox-gl-enhance"
  26. src="../../dist/mapboxgl/include-mapboxgl.js"
  27. ></script>
  28. <script type="text/javascript">
  29. var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
  30. var attribution =
  31. "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
  32. " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
  33. " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
  34. var tile1 =
  35. host +
  36. '/iserver/services/data-osm-line/rest/data/datasources/osm-line/datasets/railways/tileFeature.mvt?returnAttributes=true&width=512&height=512&x={x}&y={y}&scale={scale}&origin=' +
  37. encodeURIComponent('{x:-180,y:90}');
  38. var tile2 =
  39. host +
  40. '/iserver/services/data-osm-line/rest/data/datasources/osm-line/datasets/waterways/tileFeature.mvt?returnAttributes=true&width=512&height=512&x={x}&y={y}&scale={scale}&origin=' +
  41. encodeURIComponent('{x:-180,y:90}');
  42. var map = new mapboxgl.Map({
  43. container: 'map',
  44. style: {
  45. version: 8,
  46. sources: {
  47. 'raster-tiles': {
  48. attribution: attribution,
  49. type: 'raster',
  50. tiles: [
  51. host +
  52. '/iserver/services/map-china400/rest/maps/ChinaDark/tileImage.png?scale={scale}&x={x}&y={y}&width={width}&height={height}&prjCoordSys=' +
  53. encodeURIComponent('{epsgCode:4326}') +
  54. '&origin=' +
  55. encodeURIComponent('{x:-180,y:90}')
  56. ],
  57. tileSize: 256
  58. },
  59. railways: {
  60. attribution: attribution,
  61. type: 'vector',
  62. tiles: [tile1]
  63. },
  64. waterways: {
  65. attribution: attribution,
  66. type: 'vector',
  67. tiles: [tile2]
  68. }
  69. },
  70. layers: [
  71. {
  72. id: 'simple-tiles',
  73. type: 'raster',
  74. source: 'raster-tiles',
  75. minzoom: 0,
  76. maxzoom: 22
  77. },
  78. {
  79. id: 'waterwaysLayer',
  80. type: 'line',
  81. source: 'waterways',
  82. 'source-layer': 'waterways@osm-line',
  83. paint: {
  84. 'line-width': 1,
  85. 'line-color': 'rgb(37, 140, 249)',
  86. 'line-opacity': 0.6
  87. }
  88. },
  89. {
  90. id: 'railwaysLayer',
  91. type: 'line',
  92. source: 'railways',
  93. 'source-layer': 'railways@osm-line',
  94. paint: {
  95. 'line-width': 1,
  96. 'line-blur': 2,
  97. 'line-color': 'orange',
  98. 'line-opacity': 0.6
  99. }
  100. }
  101. ]
  102. },
  103. crs: 'EPSG:4326',
  104. center: [120.91740589709298, 31.519742618586378],
  105. zoom: 8
  106. });
  107. </script>
  108. </body>
  109. </html>