echarts_linesDrawMillionsRailwaysNetwork_4326.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <html>
  5. <head>
  6. <meta charset='utf-8' />
  7. <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
  8. <title data-i18n="resources.title_echartsLinesMillions_railwaysWGS84"></title>
  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='mapbox-gl-enhance,echarts' src="../../dist/mapboxgl/include-mapboxgl.js"></script>
  26. <script type="text/javascript">
  27. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  28. var map = new mapboxgl.Map({
  29. container: 'map',
  30. style: {
  31. "version": 8,
  32. "sources": {
  33. "raster-tiles": {
  34. "type": "raster",
  35. "tiles": [host + '/iserver/services/map-world/rest/maps/World'],
  36. "rasterSource":"iserver",
  37. "tileSize": 256,
  38. },
  39. },
  40. "layers": [{
  41. "id": "simple-tiles",
  42. "type": "raster",
  43. "source": "raster-tiles",
  44. "minzoom": 0,
  45. "maxzoom": 18
  46. }]
  47. },
  48. crs: mapboxgl.CRS.EPSG4326,
  49. center: [106, 37.94],
  50. zoom: 4,
  51. itemStyle: {
  52. normal: {
  53. color: 'transparent',
  54. borderColor: 'rgba(255,255,255,0.1)',
  55. borderWidth: 1
  56. }
  57. },
  58. roam: true,
  59. silent: true
  60. });
  61. map.addControl(new mapboxgl.NavigationControl(), 'top-left');
  62. var echartslayer = new EchartsLayer(map);
  63. var CHUNK_COUNT = 19;
  64. function fetchData(idx) {
  65. if (idx > CHUNK_COUNT) {
  66. return;
  67. }
  68. var dataURL = "https://iclient.supermap.io/web/data/bigdata_railway_10w/data_" + idx + ".bin";
  69. var xhr = new XMLHttpRequest();
  70. xhr.open('GET', dataURL, true);
  71. xhr.responseType = 'arraybuffer';
  72. xhr.onload = function (e) {
  73. var rawData = new Float32Array(this.response);
  74. echartslayer.chart.appendData({
  75. seriesIndex: 0,
  76. data: rawData
  77. });
  78. fetchData(idx + 1);
  79. };
  80. xhr.send();
  81. }
  82. option = {
  83. progressive: 20000,
  84. GLMap: {
  85. roam: true
  86. },
  87. title: {
  88. top: '10px',
  89. text: '全国铁路网',
  90. subtext: '四百万点',
  91. left: 'center',
  92. textStyle: {
  93. color: '#fff'
  94. },
  95. subtextStyle: {
  96. color: '#fff'
  97. }
  98. },
  99. coordinateSystem: 'GLMap',
  100. series: [{
  101. type: 'lines',
  102. blendMode: 'lighter',
  103. coordinateSystem: 'GLMap',
  104. dimensions: ['value'],
  105. data: new Float64Array(),
  106. polyline: true,
  107. large: true,
  108. lineStyle: {
  109. color: 'orange',
  110. width: 2,
  111. opacity: 0.3
  112. }
  113. }]
  114. };
  115. fetchData(0);
  116. echartslayer.chart.setOption(option);
  117. </script>
  118. </body>
  119. </html>