Javascript WGS84结果能否转换为NAD83格式?
我有一个HTML5表单,它使用geolocator脚本来填充文本框,其中包含平板电脑GPS上的lat/long和高程。使用WGS84数据返回数据,但用于存储表单数据的数据库需要NAD83数据 是否有脚本在填充字段之前将默认WGS84数据转换为NAD83,或者是否所有数据都必须进行后处理Javascript WGS84结果能否转换为NAD83格式?,javascript,html,gps,Javascript,Html,Gps,我有一个HTML5表单,它使用geolocator脚本来填充文本框,其中包含平板电脑GPS上的lat/long和高程。使用WGS84数据返回数据,但用于存储表单数据的数据库需要NAD83数据 是否有脚本在填充字段之前将默认WGS84数据转换为NAD83,或者是否所有数据都必须进行后处理 <fieldset> <div> Latitude: <input type="text" id="lat" name="lat" ></div> <
<fieldset>
<div> Latitude: <input type="text" id="lat" name="lat" ></div>
<div>Longitude: <input type="text" id="long" name="long" value=""></div>
<div><label><input type="text" id="acc" name="long" value="" data-mini="true"></label>
<button onclick="getLocationConstant()" value="Get Location" data-mini="true"></button>
</div>
<script>
function getLocationConstant()
{
if(navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(onGeoSuccess,onGeoError);
} else {
alert("Your browser or device doesn't support Geolocation");
}
}
// If we have a successful location update
function onGeoSuccess(event)
{
document.getElementById("lat").value = event.coords.latitude;
document.getElementById("long").value = event.coords.longitude;
document.getElementById("height").value = event.coords.altitude;
document.getElementById("acc").value = event.coords.accuracy +"% accuracy";
}
// If something has gone wrong with the geolocation request
function onGeoError(event)
{
alert("Error code " + event.code + ". " + event.message);
}
</script>
<div>Elevation: <input type="text" name="height" id="height"></div>
</fieldset>
纬度:
经度:
函数getLocationConstant()
{
if(导航器.地理位置)
{
navigator.geolocation.getCurrentPosition(onGeoSuccess,onGeoError);
}否则{
警报(“您的浏览器或设备不支持地理定位”);
}
}
//如果我们有一个成功的位置更新
功能onGeoSuccess(事件)
{
document.getElementById(“lat”).value=event.coords.latitude;
document.getElementById(“long”).value=event.coords.longitude;
document.getElementById(“height”).value=event.coords.altime;
document.getElementById(“acc”).value=event.coords.accurity+%accurity;
}
//如果地理定位请求出现问题
函数onGeoError(事件)
{
警报(“错误代码”+事件代码+”+事件消息);
}
高程:
在不同基准或投影之间转换的公式太复杂
有一个开源项目Proj4(javascript版本)可以做任何关于地图投影的事情。您可以从以下网站获得: