当前位置:网站首页>Cesium Click to obtain longitude and latitude (2D coordinates)
Cesium Click to obtain longitude and latitude (2D coordinates)
2022-06-28 02:09:00 【The most ferocious little seal】
The following code applies to Two dimensional coordinates
, Obtain the longitude and latitude coordinates of the ellipsoid surface .
handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(event => {
// Screen coordinates are converted to spatial coordinates
let cartesian = viewer.camera.pickEllipsoid(event.position, viewer.scene.globe.ellipsoid);
if (cartesian == undefined) {
console.log(' No coordinates obtained ')
} else {
// Space coordinates to world coordinates ( radian )
let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
// Radian to angle ( Longitude and latitude )
let lon = Cesium.Math.toDegrees(cartographic.longitude); // Longitude value
let lat = Cesium.Math.toDegrees(cartographic.latitude); // Latitude value
console.log(' Longitude and latitude are :', {
x: lon, y: lat });
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK)
Cancel the left click event
handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK)
Be careful : pickEllipsoid
There is a certain error when loading the terrain , The more concave and convex the terrain is , The greater the error , Therefore, the above aspects can only be used for Two dimensional coordinates
Acquisition .
See my other article on 3D coordinates
边栏推荐
- Review of drug discovery-03-molecular design and optimization
- Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)
- Capacitor
- Interviewer asked: Inheritance of JS
- Appium自动化测试基础— 补充:App的包名(appPackage)和启动名(appActivity)
- The interviewer asked: this point of JS
- What problems should be evaluated before implementing MES management system
- Prometeus 2.35.0 新特性
- Chapitre 4: redis
- 评价——灰色关联分析
猜你喜欢
Overview of drug discovery-01 overview of drug discovery
9. Openfeign service interface call
Appium自动化测试基础— 补充:App的包名(appPackage)和启动名(appActivity)
[embedded foundation] memory (cache, ram, ROM, flash)
什么是数字化?什么是数字化转型?为什么企业选择数字化转型?
树莓派实现温控风扇智能降温
The research group of Xuyong and duanwenhui of Tsinghua University has developed an efficient and accurate first principles electronic structure deep learning method and program
Shardingsphere-proxy-5.0.0 establish MySQL read / write separation connection (6)
Using redis bitmap to realize personnel online monitoring
Adobe Premiere基础-声音调整(音量矫正,降噪,电话音,音高换挡器,参数均衡器)(十八)
随机推荐
声网 VQA:将实时互动中未知的视频画质用户主观体验变可知
Capacitor
Hi, you have a code review strategy to check!
【ELT.ZIP】OpenHarmony啃论文俱乐部—数据密集型应用内存压缩
Comprehensive evaluation of free, easy-to-use and powerful open source note taking software
Adobe Premiere基础-常用的视频特效(裁剪,黑白,剪辑速度,镜像,镜头光晕)(十五)
I/o limit process and CPU limit process
The interviewer asked: this point of JS
ionic4实现半星评分
Intranet penetration with FRP
一张图弄懂 MIT,BSD,Apache几种开源协议之间的区别
[Yocto RM]3 - Yocto Project Releases and the Stable Release Process
1382. 将二叉搜索树变平衡-常规方法
TIA botu_ Concrete method of making analog input and output Global Library Based on SCL language
有监督、无监督与半监督学习
Adobe Premiere Basics - common video effects (cropping, black and white, clip speed, mirroring, lens halo) (XV)
Review of drug discovery-03-molecular design and optimization
Numpy----np.meshgrid()
The research group of Xuyong and duanwenhui of Tsinghua University has developed an efficient and accurate first principles electronic structure deep learning method and program
Xctf attack and defense world misc wage earner advanced zone