一米分别对应的经纬度

2019-12-02  本文已影响0人  宿州刘德华

/**
 * 一米对应的经度
 * @param lat 在哪个纬度
 */
function oneMeter2Lng(lat){
    //不同纬度,地球的周长不一样
    const earthLength=2 * 6378137 * Math.PI ;//赤道长度(最大长度)
    let lat2EarthLength = earthLength* Math.cos(Math.abs(lat));
    return parseFloat(360/lat2EarthLength).toFixed(10);
}
/**
 * 一米对应的纬度
 * @param lat
 */
function oneMeter2Lat(){
    const earthLength=2 * 6378137 * Math.PI ;
    return parseFloat(360/earthLength).toFixed(10);
}

上一篇 下一篇

猜你喜欢

热点阅读