cesium米转换经纬度,如何将纬度或经度转换为米?

If I have a latitude or longitude reading in standard NMEA format is there an easy way / formula to convert that reading to meters, which I can then implement in Java (J9)?

Edit:

Ok seems what I want to do is not possible easily, however what I really want to do is:

Say I have a lat and long of a way point and a lat and long of a user is there an easy way to compare them to decide when to tell the user they are within a reasonably close distance of the way point? I realise reasonable is subject but is this easily do-able or still overly maths-y?

解决方案

Here is a javascript function:

function measure(lat1, lon1, lat2, lon2){ // generally used geo measurement function

var R = 6378.137; // Radius of earth in KM

var dLat = lat2 * Math.PI / 180 - lat1 * Math.PI / 180;

var dLon = lon2 * Math.PI / 180 - lon1 * Math.PI / 180;

var a = Math.sin(dLat/2) * Math.sin(dLat/2) +

Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) *

Math.sin(dLon/2) * Math.sin(dLon/2);

var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));

var d = R * c;

return d * 1000; // meters

}

Explanation:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值