html5 地理位置定位的时候,想用enableHighAccuracy提高精确度,但是。。
16lz
2021-01-22
感觉没什么用是怎么回事呢?还有什么办法可以提高精确度的吗?
要结合云计算
functiondw()
{
if(navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition,showError,{enableHighAccuracy:true});
//navigator.geolocation.getCurrentPosition(showPosition,showError);
}
else
{
alert("Geolocationisnotsupportedbythisbrowser.");
}
}
functionshowPosition(position)
{
lat=position.coords.latitude;
lon=position.coords.longitude;
document.getElementById("HD_JD").value=lon;
document.getElementById("HD_WD").value=lat;
//alert(lon+","+lat);
document.getElementById("HD_ADD").click();
alert("成功!");
}
functionshowError(error)
{
varx=document.getElementById("demo");
switch(error.code)
{
caseerror.PERMISSION_DENIED:
x.innerHTML="您拒绝了使用位置共享服务,查询已取消。"
break;
caseerror.POSITION_UNAVAILABLE:
x.innerHTML="我们暂时无法为您所在的位置提供位置服务。"
break;
caseerror.TIMEOUT:
x.innerHTML="连接超时,请重试。"
break;
caseerror.UNKNOWN_ERROR:
x.innerHTML="未知错误!"
break;
}
}
7 个解决方案
#1
要结合云计算
更多相关文章
- 在PHP中更改关联数组索引的位置
- 按钮和文本移回原始位置
- ubuntu_mysql怎么判断自己的库和头文件的位置
- centos7 移动mysql5.7.19 数据存储位置
- js金额数字格式化实现代码(三位加逗号处理保留两位置小数)
- js“DOM事件”之鼠标事件、js的测试方法、js代码的放置位置
- 使用谷歌地图computeDistanceBetween获取最近的位置返回NaN
- Google Maps API v3:如何设置缩放级别和地图中心到用户提交的位置
- 拒绝获取不安全标题“位置”