$page->setTitle("Edit Address"); $page->addStyleSheet('../css/styles.css'); $page->addScript('../js/global.js'); $page->addBodyContent($header_and_menu); $page->addBodyContent('<div id="content_wide">'); $page->addBodyContent($navbar); $page->addBodyContent($form->renderForm()); $page->addBodyContent('</div>'); $page->display(); } else { // update // if making a change to a property record, we should remove pcid and dump data as it will be incorrect $result = new Validate(); $results = $result->process($formData1, $_GET); $db_data = $results['Results']; if ($db_data['pro_latitude'] && $db_data['pro_longitude']) { include_once dirname(__FILE__) . "/../../../../../htdocs/mapping/phpcoord-2.3.php"; $latLng = new LatLng($db_data['pro_latitude'], $db_data['pro_longitude']); $latLng->WGS84ToOSGB36(); $eastNorth = $latLng->toOSRef(); $db_data['pro_east'] = $eastNorth->easting; $db_data['pro_north'] = $eastNorth->northing; } if ($_GET["saveas"] == 'Add as New') { $pro_id = db_query($db_data, "INSERT", "property", "pro_id"); header("Location:?pro_id=" . $pro_id); } else { db_query($db_data, "UPDATE", "property", "pro_id", $_GET["pro_id"]); header("Location:?pro_id=" . $_GET["pro_id"]); } }
/** * @expectedException \PHPUnit_Framework_Error_Warning */ public function testWGS84ToOSGB36BadEllipsoid() { $LatLng = new LatLng(12.3, 12.3, RefEll::Clarke1866()); $LatLng->WGS84ToOSGB36(); }
?> </p> <p> Using WGS84 (convert a latitude and longitude using the WGS84 datum to an OSGB grid reference): <pre>$ll2w = new LatLng(52.657570301933, 1.7179215806451); echo "Latitude/Longitude: " . $ll2->toString() . "<br />"; $ll2w->WGS84ToOSGB36(); $os2w = $ll2w->toOSRef(); echo "Converted to OS Grid Ref: " . $os2w->toString() . " - " . $os2w->toSixFigureString();</pre> <?php $ll2w = new LatLng(52.657570301933, 1.7179215806451); echo "Latitude/Longitude: " . $ll2->toString() . "<br />"; $ll2w->WGS84ToOSGB36(); $os2w = $ll2w->toOSRef(); echo "Converted to OS Grid Ref: " . $os2w->toString() . " - " . $os2w->toSixFigureString(); ?> </p> <h2>Convert Six-Figure OS Grid Reference String to an OSRef Object</h2> <p> To convert a string representing a six-figure OSGB grid reference: <pre>$os6 = "TG514131"; echo "Six figure string: " . $os6 . "<br />"; $os6x = getOSRefFromSixFigureReference($os6); echo "Converted to OS Grid Ref: " . $os6x->toString() . " - " . $os6x->toSixFigureString();</pre>
function LLtoOSGB($lat, $lng) { $ll2w = new LatLng($lat, $lng); $ll2w->WGS84ToOSGB36(); $os2w = $ll2w->toOSRef($lat, $lng); $osgrid = $os2w->toSixFigureString(); return $osgrid; }