echarts_linesDrawMillionsBeijingRoadsNetwork.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <html>
  5. <head>
  6. <meta charset='utf-8'/>
  7. <title data-i18n="resources.title_echartsLinesMillions_bjRoads"></title>
  8. <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no'/>
  9. <script type="text/javascript" include="jquery" src="../js/include-web.js"></script>
  10. <style>
  11. body {
  12. margin: 0;
  13. padding: 0;
  14. }
  15. #map {
  16. position: absolute;
  17. top: 0;
  18. bottom: 0;
  19. width: 100%;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div id='map'></div>
  25. <script type="text/javascript" include="echarts" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
  26. <script type="text/javascript">
  27. var attribution = "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
  28. " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
  29. " Image <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a> | </span>" +
  30. " <a href='https://echarts.baidu.com' target='_blank'>© 2018 " + resources.title_3baidu + " ECharts</a>";
  31. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  32. var tileURL = host + "/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}";
  33. var map = new mapboxgl.Map({
  34. container: 'map',
  35. style: {
  36. "version": 8,
  37. "sources": {
  38. "raster-tiles": {
  39. "attribution": attribution,
  40. "type": "raster",
  41. "tiles": [tileURL],
  42. "tileSize": 256,
  43. },
  44. },
  45. "layers": [{
  46. "id": "simple-tiles",
  47. "type": "raster",
  48. "source": "raster-tiles",
  49. "minzoom": 0,
  50. "maxzoom": 18
  51. }]
  52. },
  53. center: [116.36, 40.0],
  54. zoom: 9,
  55. itemStyle: {
  56. normal: {
  57. color: 'transparent',
  58. borderColor: 'rgba(255,255,255,0.1)',
  59. borderWidth: 1
  60. }
  61. },
  62. roam: true,
  63. silent: true
  64. });
  65. map.addControl(new mapboxgl.NavigationControl(), 'top-left');
  66. var echartslayer = new EchartsLayer(map);
  67. var CHUNK_COUNT = 19;
  68. function fetchData(idx) {
  69. if (idx > CHUNK_COUNT) {
  70. return;
  71. }
  72. var dataURL = "https://iclient.supermap.io/web/data/bigdata_beijingroads/data_" + idx + ".bin";
  73. var xhr = new XMLHttpRequest();
  74. xhr.open('GET', dataURL, true);
  75. xhr.responseType = 'arraybuffer';
  76. xhr.onload = function (e) {
  77. var rawData = new Float32Array(this.response);
  78. echartslayer.chart.appendData({
  79. seriesIndex: 0,
  80. data: rawData
  81. });
  82. fetchData(idx + 1);
  83. };
  84. xhr.send();
  85. }
  86. option = {
  87. animation: false,
  88. progressive: 20000,
  89. GLMap: {
  90. roam: true
  91. },
  92. title: {
  93. top: '10px',
  94. text: resources.text_echartsLinesMillions_bjRoads,
  95. subtext: resources.text_echartsLinesMillions_bjRoads_subtext,
  96. left: 'center',
  97. textStyle: {
  98. color: '#fff'
  99. },
  100. subtextStyle: {
  101. color: '#fff'
  102. }
  103. },
  104. coordinateSystem: 'GLMap',
  105. series: [{
  106. name: 'beijingRoads',
  107. type: 'lines',
  108. blendMode: 'lighter',
  109. coordinateSystem: 'GLMap',
  110. dimensions: ['value'],
  111. data: new Float64Array(),
  112. polyline: true,
  113. large: true,
  114. lineStyle: {
  115. color: 'orange',
  116. width: 1,
  117. opacity: 0.3
  118. }
  119. }]
  120. };
  121. fetchData(0);
  122. echartslayer.chart.setOption(option);
  123. </script>
  124. </body>
  125. </html>