echarts_linesDrawMillionsRoadsNetwork_50WFeatures.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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,ol3-echarts"
  11. src="../../dist/ol/include-ol.js"></script>
  12. <style>
  13. body {
  14. margin: 0;
  15. padding: 0;
  16. }
  17. #map {
  18. position: absolute;
  19. top: 0;
  20. bottom: 0;
  21. width: 100%;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <div id='map'></div>
  27. <script type="text/javascript">
  28. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  29. var tileURL = host + "/iserver/services/map-china400/rest/maps/ChinaDark";
  30. var map = new ol.Map({
  31. target: 'map',
  32. controls: ol.control.defaults({attributionOptions: {collapsed: false}})
  33. .extend([new ol.supermap.control.Logo()]),
  34. view: new ol.View({
  35. center: [106, 37.94],
  36. zoom: 5,
  37. projection: 'EPSG:4326',
  38. multiWorld: true
  39. }),
  40. layers: [new ol.layer.Tile({
  41. source: new ol.source.OSM({}),
  42. source: new ol.source.TileSuperMapRest({
  43. url: tileURL,
  44. prjCoordSys: {"epsgCode": 4326}
  45. }),
  46. projection: 'EPSG:4326'
  47. })]
  48. });
  49. var echartslayer = new ol3Echarts(null, {
  50. hideOnMoving: true,
  51. hideOnZooming: true
  52. });
  53. echartslayer.appendTo(map);
  54. var option = {
  55. progressive: 20000,
  56. title: {
  57. top: '10px',
  58. text: resources.text_echartsLinesMillions_roads,
  59. subtext: resources.text_echartsLinesMillions_roads_subtext,
  60. left: 'center',
  61. textStyle: {
  62. color: '#fff'
  63. },
  64. subtextStyle: {
  65. color: '#fff'
  66. }
  67. },
  68. series: [{
  69. type: 'lines',
  70. blendMode: 'lighter',
  71. dimensions: ['value'],
  72. data: new Float64Array(),
  73. polyline: true,
  74. large: true,
  75. lineStyle: {
  76. color: 'orange',
  77. width: 1,
  78. opacity: 0.3
  79. }
  80. }]
  81. };
  82. var CHUNK_COUNT = 27;
  83. function fetchData(idx) {
  84. if (idx > CHUNK_COUNT) {
  85. return;
  86. }
  87. var dataURL = "https://iclient.supermap.io/web/data/bigdata_roads_50w/data_" + idx + ".bin";
  88. var xhr = new XMLHttpRequest();
  89. xhr.open('GET', dataURL, true);
  90. xhr.responseType = 'arraybuffer';
  91. xhr.onload = function (e) {
  92. var rawData = new Float32Array(this.response);
  93. echartslayer.appendData({
  94. seriesIndex: 0,
  95. data: rawData
  96. });
  97. fetchData(idx + 1);
  98. };
  99. xhr.send();
  100. }
  101. echartslayer.setChartOptions(option);
  102. fetchData(0);
  103. </script>
  104. </body>
  105. </html>