How to Convert OS Grid to GPS
- 1). Open Notepad.
- 2). Copy and paste the Javascript functions to convert latitude and longitude to OS grid points (see Resources) into Notepad.
- 3). Create textboxes by pasting this form into Notepad:
<form name="f" action="none!">
<table >
<tr>
<td>OS Grid Ref</td>
<td colspan="3"><input name="gridRef" value="TG 5140 1317" size="12"></td>
</tr>
<tr>
<td>Latitude/Longitude</td>
<td><input name="latWGS84" value="" size="12"></td>
<td> </td>
<td><input name="lonWGS84" value="" size="12"></td>
</tr>
<tr><td><input type="submit"></td></tr>
</table>
</form> - 4). Add this Javascript function to the Notepad document:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#gridRef').change( function() {
var pOSGB = OSGridToLatLong($('#gridRef').val());
var pWGS = convertOSGB36toWGS84(pOSGB);
$('#latWGS84').val(pWGS.lat.toLat(2));
$('#lonWGS84').val(pWGS.lon.toLon(2));
});
});
</script> - 5). Save the Notepad document with an ".html" extension. Open it in your browser.
- 6). Enter the OS Grid reference in the "OS Grid Ref" text field and click the "Submit" button. The equivalent GPS coordinates will appear in the "Latitude" and "Longitude" text boxes.
Source...