相关疑难解决方法(0)

计算两个纬度 - 经度点之间的距离?(Haversine配方)

如何计算纬度和经度指定的两点之间的距离?

为了澄清,我想要以公里为单位的距离; 这些要点使用WGS84系统,我想了解可用方法的相对准确性.

algorithm math maps latitude-longitude haversine

852
推荐指数
19
解决办法
72万
查看次数

如何在JavaScript中查找到已知位置的距离

在浏览器中使用JavaScript,如何确定从当前位置到具有纬度和经度的其他位置的距离?

javascript gps distance geolocation latitude-longitude

17
推荐指数
1
解决办法
3万
查看次数

使用Bing或Google Maps API获取用户的位置(纬度,经度)

有没有办法使用Bing Maps API或Google Maps API检索用户的纬度和经度.我想我看到了一个代码片段,其中"自动定位我"功能用于在地图上标记用户:

var geoLocationProvider = new Microsoft.Maps.GeoLocationProvider(map);  
geoLocationProvider.getCurrentPosition(); 
Run Code Online (Sandbox Code Playgroud)

但是该函数不返回任何数据,它只是在地图上设置位置,而我需要该位置来执行一些计算,即计算哪个预定义的位置列表最接近当前用户位置.除此之外,这个API中的任何一个都可以计算作为输入提供的两个位置(lat,lon)之间的距离吗?

谢谢,Pawel

google-maps geolocation bing-maps

9
推荐指数
1
解决办法
2万
查看次数

JavaScript中的Sin和cos

我正在尝试用JavaScript构建计算器.它除了罪和cos之外都有效,它们给出了错误和意想不到的结果.

Sin和Cos给出了错误的结果

罪(180)= 0

在代码sin(180)= - 0.8011526357338304

在此输入图像描述

我的代码如下所示,

JavaScript的:

function d(val){
    if(val=="sin"){
        var x=document.getElementById("d").value;
        document.getElementById("d").value=Math.sin(x);
    }
    if(val=="cos"){
        var x=document.getElementById("d").value;
        document.getElementById("d").value=Math.cos(x);
    }
    if(val=="envers"){
        var x=document.getElementById("d").value;
        document.getElementById("d").value=eval(1/x);
    }
    if(val=="sqrt"){
        var x=document.getElementById("d").value;
        document.getElementById("d").value=Math.sqrt(x);
    }
}

function c(val){
    document.getElementById("d").value=val;
}

function v(val){
    document.getElementById("d").value+=val;
}

function e(){ 
    try { 
      c(eval(document.getElementById("d").value)) 
    } 
    catch(e){
        c('Error') 
    } 
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<div class="display">
    <p>
        <input type="text" readonly size="14" id="d">
        <input type="button" class="button black" value="C" onclick='c("")'>  
    </p>
</div>
<div class="keys">
    <p>
        <input type="button" class="button black" value="1" onclick='v("1")'>
        <input type="button" …
Run Code Online (Sandbox Code Playgroud)

javascript

-1
推荐指数
1
解决办法
2454
查看次数