| @@ -1,4 +1,4 @@ | |||
| <?php /* Smarty version 2.6.16, created on 2009-10-05 14:04:40 | |||
| <?php /* Smarty version 2.6.16, created on 2010-01-20 12:08:45 | |||
| compiled from index.tpl */ ?> | |||
| <?php $_smarty_tpl_vars = $this->_tpl_vars; | |||
| $this->_smarty_include(array('smarty_include_tpl_file' => "header.tpl", 'smarty_include_vars' => array())); | |||
| @@ -1,4 +1,4 @@ | |||
| <?php /* Smarty version 2.6.16, created on 2009-10-05 14:04:40 | |||
| <?php /* Smarty version 2.6.16, created on 2010-01-20 12:08:45 | |||
| compiled from header.tpl */ ?> | |||
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |||
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
| @@ -289,29 +289,24 @@ function scrape_applications_islington ($search_url, $info_url_base, $comment_ur | |||
| //postcode to location | |||
| function postcode_to_location($postcode){ | |||
| // We don't actually need to fetch the page, we | |||
| // can get everything we need from the url we are | |||
| // redirected to. | |||
| $clean_postcode = strtolower($postcode); | |||
| $clean_postcode = str_replace(" ","+", $clean_postcode); | |||
| $url = "http://ernestmarples.com/?p=" . $clean_postcode . "&f=csv"; | |||
| $result = file_get_contents($url); | |||
| $result = split(",", $result); | |||
| if(count($result) != 2){ | |||
| trigger_error("No lat/long could be found"); | |||
| } | |||
| $lat = $result[0]; | |||
| $lng = $result[1]; | |||
| function postcode_to_location($postcode){ | |||
| $LatLng = new LatLng($lat, $lng); | |||
| $OSBG = $LatLng->toOSRef(); | |||
| // We don't actually need to fetch the page, we | |||
| // can get everything we need from the url we are | |||
| // redirected to. | |||
| $clean_postcode = strtolower($postcode); | |||
| $clean_postcode = str_replace(" ","+", $clean_postcode); | |||
| $return = array($OSBG->easting, $OSBG->northing); | |||
| $url = "http://www.streetmap.co.uk/newsearch.srf?type=Postcode&name=" . $clean_postcode; | |||
| } | |||
| $headers = get_headers($url, 1); | |||
| $location = $headers["Location"]; | |||
| $location_regex = "/x=(\d*)&y=(\d*)&/"; | |||
| preg_match ($location_regex, $location, $matches); | |||
| return array_slice ($matches, 1); | |||
| } | |||
| function location_to_postcode($easting, $northing) { | |||
| $url = sprintf( | |||
| @@ -33,41 +33,32 @@ class preview_page { | |||
| $this->warnings .= "No area size specified "; | |||
| } | |||
| if ($this->warnings == ""){ | |||
| $url = "http://ernestmarples.com/?p=sw98jx&f=csv"; | |||
| $result = file_get_contents($url); | |||
| $result = split(",", $result); | |||
| if(count($result) != 2){ | |||
| trigger_error("No lat/long could be found"); | |||
| } | |||
| $lat = $result[0]; | |||
| $lng = $result[1]; | |||
| if ($this->warnings == ""){ | |||
| //Get OS ref from postcode | |||
| $xy = postcode_to_location($_GET['postcode']); | |||
| //Get OS ref from postcode | |||
| $xy = postcode_to_location($_GET['postcode']); | |||
| //Get the centroid long / lat (google maps doesnt handle grid refs) | |||
| //$os_ref = new OSRef($xy[0], $xy[1]); | |||
| //$long_lat = $os_ref->toLatLng(); | |||
| $this->center_long = $lng; //$long_lat->lng; | |||
| $this->center_lat = $lat; //$long_lat->lat; | |||
| //get long lat for the bounding box (OS grid refs are in meters in case you were wondering) | |||
| //bottom left | |||
| $area_size_meters = alert_size_to_meters($_GET['area_size']); | |||
| $os_ref = new OSRef($xy[0] - $area_size_meters, $xy[1] - $area_size_meters); | |||
| $long_lat = $os_ref->toLatLng(); | |||
| $this->bottom_left_long = $long_lat->lng; | |||
| $this->bottom_left_lat = $long_lat->lat; | |||
| //top right | |||
| $area_size_meters = alert_size_to_meters($_GET['area_size']); | |||
| $os_ref = new OSRef($xy[0] + $area_size_meters, $xy[1] + $area_size_meters); | |||
| $long_lat = $os_ref->toLatLng(); | |||
| $this->top_right_long = $long_lat->lng; | |||
| $this->top_right_lat = $long_lat->lat; | |||
| //Get the centroid long / lat (google maps doesnt handle grid refs) | |||
| $os_ref = new OSRef($xy[0], $xy[1]); | |||
| $long_lat = $os_ref->toLatLng(); | |||
| $this->center_long = $long_lat->lng; | |||
| $this->center_lat = $long_lat->lat; | |||
| //get long lat for the bounding box (OS grid refs are in meters in case you were wondering) | |||
| //bottom left | |||
| $area_size_meters = alert_size_to_meters($_GET['area_size']); | |||
| $os_ref = new OSRef($xy[0] - $area_size_meters, $xy[1] - $area_size_meters); | |||
| $long_lat = $os_ref->toLatLng(); | |||
| $this->bottom_left_long = $long_lat->lng; | |||
| $this->bottom_left_lat = $long_lat->lat; | |||
| //top right | |||
| $area_size_meters = alert_size_to_meters($_GET['area_size']); | |||
| $os_ref = new OSRef($xy[0] + $area_size_meters, $xy[1] + $area_size_meters); | |||
| $long_lat = $os_ref->toLatLng(); | |||
| $this->top_right_long = $long_lat->lng; | |||
| $this->top_right_lat = $long_lat->lat; | |||
| } | |||
| @@ -1,3 +1,12 @@ | |||
| --------------------------- | |||
| Because of ongoing difficulty sourcing accurate postcode data, some planning applications may be missing or slightly out when viewed on a map. To help resolve this you may with to make a short submission to the government's consultation process asking for postcode data to be made freely available: http://www.communities.gov.uk/corporate/contact?consultation=true | |||
| --------------------------- | |||
| {foreach name="applications" from="$applications" item="application"} | |||
| {$application->address|upper} {$application->postcode|upper} ({$application->council_reference|upper}) | |||
| @@ -7,12 +7,9 @@ | |||
| <h3>Thanks, your alert has been activated</h3> | |||
| <div class="ad"> | |||
| <h4>Find out even more about your local area using StreetWire</h4> | |||
| <h4>Help make the 20010 Election the most transparent ever</h4> | |||
| <p> | |||
| StreetWire is like PlanningAlerts for everything. Including licensing applications, | |||
| local news, crime and missing animals. | |||
| <br/> | |||
| <a href="http://www.streetwire.org">Visit StreetWire</a> | |||
| <a href="http://www.democracyclub.org.uk">Join democracy club!</a> | |||
| </p> | |||
| </div> | |||
| @@ -45,6 +45,7 @@ | |||
| <div id="divSiteUpdates"> | |||
| <h4>Recent site updates</h4> | |||
| <ul class="nobullets"> | |||
| <li><em>January 2010</em>Site functioning again with reduced postcode accuracy.<a href="http://www.communities.gov.uk/corporate/contact?consultation=true"> Please consider submitting feedback to the government consultation</a></li> | |||
| <li><em>May 2008</em>Now has 250 Local authorities covered</li> | |||
| <li><em>July 2007</em>Shortlisted for New Statesman New Media Award</li> | |||
| <li><em>July 2007</em>Added 21 councils inc. Lewisham, New Forest National Park and Edinburgh </li> | |||