diff --git a/data/%%45^45E^45E480CD%%index.tpl.php b/data/%%45^45E^45E480CD%%index.tpl.php index 0ca0098..df5330e 100644 --- a/data/%%45^45E^45E480CD%%index.tpl.php +++ b/data/%%45^45E^45E480CD%%index.tpl.php @@ -1,4 +1,4 @@ - _tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => "header.tpl", 'smarty_include_vars' => array())); diff --git a/data/%%F7^F7F^F7F34188%%header.tpl.php b/data/%%F7^F7F^F7F34188%%header.tpl.php index 06dabd4..2831948 100644 --- a/data/%%F7^F7F^F7F34188%%header.tpl.php +++ b/data/%%F7^F7F^F7F34188%%header.tpl.php @@ -1,4 +1,4 @@ - diff --git a/docs/include/scraper_support.php b/docs/include/scraper_support.php index d61c09d..8f442f6 100644 --- a/docs/include/scraper_support.php +++ b/docs/include/scraper_support.php @@ -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( diff --git a/docs/preview.php b/docs/preview.php index dadf1c4..073a6e2 100644 --- a/docs/preview.php +++ b/docs/preview.php @@ -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; } diff --git a/docs/templates/alert_email_text.tpl b/docs/templates/alert_email_text.tpl index b25ea6c..cc8013e 100644 --- a/docs/templates/alert_email_text.tpl +++ b/docs/templates/alert_email_text.tpl @@ -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}) diff --git a/docs/templates/confirmed.tpl b/docs/templates/confirmed.tpl index edcc00e..25aa408 100644 --- a/docs/templates/confirmed.tpl +++ b/docs/templates/confirmed.tpl @@ -7,12 +7,9 @@
- StreetWire is like PlanningAlerts for everything. Including licensing applications,
- local news, crime and missing animals.
-
- Visit StreetWire
+ Join democracy club!