echarts_linesAirline.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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_linesAirline"></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" exclude='iclient-mapboxgl' include="echarts"
  26. src="../../dist/mapboxgl/include-mapboxgl.js"></script>
  27. <script type="text/javascript">
  28. var attribution = "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
  29. " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
  30. " Image <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a> | </span>" +
  31. " <a href='https://echarts.baidu.com' target='_blank'>© 2018 " + resources.title_3baidu + " ECharts</a>";
  32. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  33. var tileURL = host + "/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}";
  34. var map = new mapboxgl.Map({
  35. container: 'map',
  36. style: {
  37. "version": 8,
  38. "sources": {
  39. "raster-tiles": {
  40. "attribution": attribution,
  41. "type": "raster",
  42. "tiles": [tileURL],
  43. "tileSize": 256,
  44. },
  45. },
  46. "layers": [{
  47. "id": "simple-tiles",
  48. "type": "raster",
  49. "source": "raster-tiles",
  50. "minzoom": 0,
  51. "maxzoom": 22
  52. }]
  53. },
  54. center: [0, 0],
  55. zoom: 2
  56. });
  57. map.addControl(new mapboxgl.NavigationControl(), 'top-left');
  58. $.get('../data/flights.json', function (data) {
  59. function getAirportCoord(idx) {
  60. return [data.airports[idx][3], data.airports[idx][4]];
  61. }
  62. var routes = data.routes.map(function (airline) {
  63. return [
  64. getAirportCoord(airline[1]),
  65. getAirportCoord(airline[2])
  66. ];
  67. });
  68. var echartslayer = new EchartsLayer(map);
  69. echartslayer.chart.setOption(option = {
  70. title: {
  71. text: 'World Flights',
  72. left: 'center',
  73. textStyle: {
  74. color: '#eee'
  75. }
  76. },
  77. tooltip: {
  78. formatter: function (param) {
  79. var route = data.routes[param.dataIndex];
  80. return data.airports[route[1]][1] + ' > ' + data.airports[route[
  81. 2]][1];
  82. }
  83. },
  84. GLMap: {
  85. roam: true
  86. },
  87. series: [{
  88. type: 'lines',
  89. coordinateSystem: 'GLMap',
  90. data: routes,
  91. large: true,
  92. largeThreshold: 100,
  93. lineStyle: {
  94. normal: {
  95. opacity: 0.05,
  96. width: 0.5,
  97. curveness: 0.3
  98. }
  99. },
  100. // 设置混合模式为叠加
  101. blendMode: 'lighter'
  102. }]
  103. });
  104. });
  105. </script>
  106. </body>
  107. </html>