知道自己鼠标在某个竖直平面上的经纬度信息在这个竖直的平面上的实时坐标

鼠标放上去就开启map.on(mars3d.EventType.mouseMove,结合以下方法实现

复制代码
      callback: function (e) {
        // 经纬度
        const mpt = LngLatPoint.fromCartesian(e.cartesian)

        const ptNew = proj4Trans([mpt.lng, mpt.lat], "EPSG:4326", CRS.CGCS2000_GK_Zone_3)

        const inhtml = `
         ${map.getLangText("_经度")}:${mpt.lng}, ${map.getLangText("_纬度")}:${mpt.lat}, ${map.getLangText("_海拔")}:${mpt.alt},
         ${map.getLangText("_横坐标")}:${ptNew[0].toFixed(1)}, ${map.getLangText("_纵坐标")}:${ptNew[1].toFixed(1)} (CGCS2000)
        `
        globalAlert(inhtml, map.getLangText("_位置信息"))

        // 打印方便测试
        const ptX = formatNum(e.cartesian.x, 1) // 笛卡尔
        const ptY = formatNum(e.cartesian.y, 1)
        const ptZ = formatNum(e.cartesian.z, 1)
        logInfo(`经纬度:${mpt.toString()} , 笛卡尔:${ptX},${ptY},${ptZ}`)
      }
相关推荐
玫城3 小时前
[ VUE ] 封装通用数组校验组件,el-input内使用
前端·javascript·vue.js
yuanmenghao4 小时前
车载Linux 系统问题定位方法论与实战系列 - 车载 Linux 平台问题定位规范
linux·运维·服务器·网络·c++
weixin_516023076 小时前
linux下fcitx5拼音的安装
linux·运维·服务器
hunter14506 小时前
Linux 进程与计划任务
linux·运维·服务器
楼田莉子6 小时前
Linux学习之磁盘与Ext系列文件
linux·运维·服务器·c语言·学习
陌上花开缓缓归以6 小时前
linux 怎么模拟系统panic重启
linux·运维·服务器
南半球与北海道#7 小时前
前端打印(三联纸票据打印)
前端·vue.js·打印
月白风清江有声7 小时前
vscode使用git
linux·运维·服务器
董世昌417 小时前
深入浅出 JavaScript 常用事件:从原理到实战的全维度解析
前端
满栀5858 小时前
分页插件制作
开发语言·前端·javascript·jquery