0
我有一個HTML5表單,它使用geolocator腳本從平板電腦GPS填充緯度/經度爲&的文本框。數據使用WGS84數據返回,但用於存儲表單數據的數據庫需要NAD83數據。WGS84結果可以轉換爲NAD83嗎?
是否有一個腳本可以在填充字段之前將默認的WGS84數據轉換爲NAD83,還是必須對所有數據進行後處理?
<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>