当前位置: 首页 > news >正文

Cesium 显示经纬高

文章目录

    • 需求
    • 分析

需求

页面展示经、纬度和高

在这里插入图片描述

分析

  • html
<div id="latlng_show" style="width:340px;height:30px;position:absolute;bottom:40px;right:200px;z-index:1;font-size:15px;"><div style="width:100px;height:30px;float:left;"><font size="3" color="white">经度:<span id="longitude_show"></span></font></div><div style="width:100px;height:30px;float:left;"><font size="3" color="white">纬度:<span id="latitude_show"></span></font></div><div style="width:140px;height:30px;float:left;"><font size="6" color="white">视角高:<span id="altitude_show"></span>km</font></div>
</div>
  • js
<!-- 经纬度实时显示 -->
/*** 经纬度显示*/
function getLonLat() {var longitude_show = document.getElementById("longitude_show");var latitude_show = document.getElementById("latitude_show");longitude_show.innerHTML = "0";latitude_show.innerHTML = "0";var canvas = viewer.value.scene.canvas;//具体事件的实现var ellipsoid = viewer.value.scene.globe.ellipsoid;var handler = new Cesium.ScreenSpaceEventHandler(canvas);handler.setInputAction(function (movement) {//捕获椭球体,将笛卡尔二维平面坐标转为椭球体的笛卡尔三维坐标,返回球体表面的点var cartesian = viewer.value.camera.pickEllipsoid(movement.endPosition,ellipsoid);if (cartesian) {//将笛卡尔三维坐标转为地图坐标(弧度)var cartographic =viewer.value.scene.globe.ellipsoid.cartesianToCartographic(cartesian);//将地图坐标(弧度)转为十进制的度数var lat_String = Cesium.Math.toDegrees(cartographic.latitude).toFixed(4);var log_String = Cesium.Math.toDegrees(cartographic.longitude).toFixed(4);var alti_String = (viewer.value.camera.positionCartographic.height / 1000).toFixed(2);longitude_show.innerHTML = log_String;latitude_show.innerHTML = lat_String;}}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}
http://www.lryc.cn/news/142316.html

相关文章:

  • 专访 Hyper Oracle:可编程的 zkOracle 打造未来世界的超算
  • ThreadLocal存放当前用户
  • es入门实战
  • c++系列之指针
  • 网络安全:挑战与防护策略
  • AI 插件:未来的浏览器、前端与交互
  • R包开发-2.1:在RStudio中使用Rcpp制作R-Package(更新于2023.8.23)
  • 土豆叶病害识别(图像连续识别和视频识别)
  • 三、JVM监控及诊断工具-GUI篇
  • 3211064 - 错误消息 AA634 出现在 T-cd AW01N 或 T-cd AFAR 中
  • k3s or RKE2 helm安装报错dial tcp 127.0.0.1:8080: connect: connection refused
  • 网络安全应急响应预案演练
  • Redis 的混合持久化
  • ElasticSearch总结
  • 手写数字识别之损失函数
  • sleep () 和 wait () 有什么区别?
  • 第一百二十七回 空安全
  • js判断类型:typeof Object.prototype.toString instanceof constructor有什么区别?一文讲清楚
  • uview ui 1.x ActonSheet项太多,设置滚动
  • 信息化发展2
  • ubuntu18 + ros2 eloquent +python3.6
  • 围棋与育种
  • Python第三方库纵览
  • 测试.net开源音频库NAudio
  • 三方接口调用设计方案
  • OLED透明屏全贴合技术:未来显示技术的突破性创新
  • map、sync.map、concurrent-map适用场景与源码解析
  • 分布式事物实现方案及优缺点
  • java使用@interface和反射来动态生成excel
  • 【微服务】04-Polly实现失败重试和限流熔断