echarts_linesDrawMillionsRoadsNetwork_50WFeatures.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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_roads"></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. <script type="text/javascript" include="echarts" src="../../dist/leaflet/include-leaflet.js"></script>
  11. <style>
  12. body {
  13. margin: 0;
  14. padding: 0;
  15. }
  16. #map {
  17. position: absolute;
  18. top: 0;
  19. bottom: 0;
  20. width: 100%;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <div id='map'></div>
  26. <script type="text/javascript">
  27. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  28. var tileURL = host + "/iserver/services/map-china400/rest/maps/ChinaDark";
  29. map = L.map('map', {
  30. center: [37.94, 106],
  31. maxZoom: 18,
  32. zoom: 5
  33. });
  34. L.supermap.tiledMapLayer(tileURL).addTo(map);
  35. option = {
  36. progressive: 20000,
  37. title: {
  38. top: '10px',
  39. text: resources.text_echartsLinesMillions_roads,
  40. subtext: resources.text_echartsLinesMillions_roads_subtext,
  41. left: 'center',
  42. textStyle: {
  43. color: '#fff'
  44. },
  45. subtextStyle: {
  46. color: '#fff'
  47. }
  48. },
  49. series: [{
  50. type: 'lines',
  51. blendMode: 'lighter',
  52. coordinateSystem: 'leaflet',
  53. dimensions: ['value'],
  54. data: new Float64Array(),
  55. polyline: true,
  56. large: true,
  57. lineStyle: {
  58. color: 'orange',
  59. width: 1,
  60. opacity: 0.3
  61. }
  62. }]
  63. };
  64. var echartsLayer = L.supermap.echartsLayer(option).addTo(map);
  65. var CHUNK_COUNT = 27;
  66. function fetchData(idx) {
  67. if (idx > CHUNK_COUNT) {
  68. return;
  69. }
  70. var dataURL = "https://iclient.supermap.io/web/data/bigdata_roads_50w/data_" + idx + ".bin";
  71. var xhr = new XMLHttpRequest();
  72. xhr.open('GET', dataURL, true);
  73. xhr.responseType = 'arraybuffer';
  74. xhr.onload = function (e) {
  75. var rawData = new Float32Array(this.response);
  76. echartsLayer._ec.appendData({
  77. seriesIndex: 0,
  78. data: rawData
  79. });
  80. fetchData(idx + 1);
  81. };
  82. xhr.send();
  83. }
  84. fetchData(0);
  85. </script>
  86. </body>
  87. </html>