vue3 使用antv地图:地球飞线、地图打点

本文介绍了如何使用AntV库在JavaScript中创建地球模式地图,加载并处理地球数据,添加线层、标记和点层,以及实现动态数据可视化的过程。
const initEarth = () => {
  earthScene = new Scene({
    id: "earth",
    map: new Earth({
      center: [154.113164, 25.570667],
      zoom: 3,
      // pitch: 50
    }),
  });

  // 地球模式下背景色默认为 #000 通过 setBgColor 方法我们可以设置可视化层的背景色
  earthScene.setBgColor("");
  const earthlayer = new EarthLayer()
    .source(earthPic, {
      parser: {
        type: "image",
      },
    })
    .color("#2E8AE6")
    .shape("fill")
    .style({
      opacity: 1.0,
      radius: 40,
      globalOptions: {
        ambientRatio: 0.6, // 环境光
        diffuseRatio: 0.4, // 漫反射
        specularRatio: 0.1, // 高光反射
      },
    })
    .animate(true);

  const atomLayer = new EarthLayer().color("#2E8AE6").shape("atomSphere");

  const bloomLayer = new EarthLayer().color("#fff").shape("bloomSphere").style({
    opacity: 0.7,
  });
  earthScene.on("loaded", () => {
    earthScene.addLayer(earthlayer);
    earthScene.addLayer(atomLayer);
    earthScene.addLayer(bloomLayer);
    Promise.all([
      fetch(
        // earthJson
        window.location.origin + "/json/earthJson.json"
      ).then((d) => d.json()),
      // fetch(
      // 	'/public/assets/antvMap/dot.json'
      // ).then(d => d.text()),
    ]).then(function onLoad([flyline, dot]) {
      const flydata = eval(flyline);
      const dotData = dot;
      // const dotPoint = new PointLayer({ zIndex: 999999
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值