3d地图参考
    https://echarts.apache.org/examples/zh/editor.html?c=globe-echarts-gl-hello-world&gl=1
    https://echarts.apache.org/examples/zh/editor.html?c=globe-atmosphere&gl=1

    WEBGL文档 https://echarts.apache.org/zh/option-gl.html#globe
    image.png

    1. <template>
    2. <div class="chart" ref="box"/>
    3. </template>
    4. <script>
    5. import {
    6. onMounted, getCurrentInstance, defineComponent
    7. } from 'vue';
    8. import * as echarts from 'echarts/core';
    9. import {
    10. CanvasRenderer
    11. } from 'echarts/renderers';
    12. import {
    13. GlobeComponent
    14. } from 'echarts-gl/components';
    15. echarts.use(
    16. [GlobeComponent, CanvasRenderer]
    17. );
    18. const ROOT_PATH = 'https://cdn.jsdelivr.net/gh/apache/echarts-website@asf-site/examples';
    19. export default defineComponent({
    20. setup() {
    21. onMounted(() => {
    22. const { ctx } = getCurrentInstance();
    23. const element = ctx.$refs.box;
    24. // 基于准备好的dom,初始化echarts实例
    25. const myChart = echarts.init(element);
    26. // 绘制图表
    27. myChart.setOption({
    28. backgroundColor: '#000',
    29. globe: {
    30. // 基础纹理贴图
    31. baseTexture: `${ROOT_PATH}/data-gl/asset/world.topo.bathy.200401.jpg`,
    32. // 高度纹理贴图
    33. heightTexture: `${ROOT_PATH}/data-gl/asset/world.topo.bathy.200401.jpg`,
    34. // 地球定点位置,让地球更加立体
    35. displacementScale: 0.04,
    36. // 地球的大小
    37. globeRadius: 80,
    38. shading: 'realistic',
    39. // 背景贴图
    40. environment: `${ROOT_PATH}/data-gl/asset/starfield.jpg`,
    41. realisticMaterial: {
    42. // 0 表示光滑,1 粗糙
    43. roughness: 0.8
    44. },
    45. postEffect: {
    46. enable: true
    47. },
    48. // 光源
    49. light: {
    50. main: {
    51. intensity: 5,
    52. shadow: true
    53. },
    54. ambientCubemap: {
    55. texture: `${ROOT_PATH}/data-gl/asset/pisa.hdr`,
    56. diffuseIntensity: 0.2
    57. }
    58. }
    59. }
    60. });
    61. });
    62. },
    63. });
    64. </script>
    65. <style scoped>
    66. .chart {
    67. height: 100%;
    68. }
    69. </style>