@@ -308,6 +308,18 @@ function scrape_applications_islington ($search_url, $info_url_base, $comment_ur | |||||
return array_slice ($matches, 1); | return array_slice ($matches, 1); | ||||
} | } | ||||
function location_to_postcode($easting, $northing) { | |||||
$url = sprintf( | |||||
"http://streetmap.co.uk/streetmap.dll?GridConvert?name=%d,%d&type=OSGrid", | |||||
$easting, $northing); | |||||
$resp = @file($url); | |||||
if (is_array($resp)) $resp = join("\n", $resp); | |||||
$resp = strip_tags($resp); | |||||
// Kinda ghetto. Would be nice to have a nicer regex for postcodes. | |||||
if (preg_match('/Nearest\s+Post\s+Code\s+(\S+\s+\S+)/i', $resp, $mat)) | |||||
return $mat[1]; | |||||
return NULL; | |||||
} | |||||
function valid_email ($string) { | function valid_email ($string) { | ||||
$valid = false; | $valid = false; | ||||
@@ -2,7 +2,7 @@ | |||||
<p>You'd probably know if your next door neighbour was going to knock their house down (you'd get a letter through the door telling you they had applied for planning permission and asking you what you thought about it). But you probably never find out if the old cinema or pub 5 streets away is going to be converted into luxury flats until <a href="http://www.bbc.co.uk/cult/hitchhikers/gallery/tv/fordprosser.shtml">the bulldozers turned up</a>.</p> | <p>You'd probably know if your next door neighbour was going to knock their house down (you'd get a letter through the door telling you they had applied for planning permission and asking you what you thought about it). But you probably never find out if the old cinema or pub 5 streets away is going to be converted into luxury flats until <a href="http://www.bbc.co.uk/cult/hitchhikers/gallery/tv/fordprosser.shtml">the bulldozers turned up</a>.</p> | ||||
<p> | <p> | ||||
PlanningAlerts.com is a free service built by <a href="http://www.memespring.co.uk">Richard Pope</a>, <a href="http://brainoff.com">Mikel Maron</a>, Sam Smith, Duncan Parkes and Tom Hughes. The site is kindly hosted by <a href="http://www.mysociety.org">mySociety.org</a>. It searches as many local authority planning websites as it can find and emails you details of applications near you. The aim of this to enable shared scrutiny of what is being built (and <a href="http://www.urban75.net/vbulletin/showthread.php?t=154006" title="Death of the Queen">knocked down</a>) in peoples communities. | |||||
PlanningAlerts.com is a free service built by <a href="http://www.memespring.co.uk">Richard Pope</a>, <a href="http://brainoff.com">Mikel Maron</a>, Sam Smith, Duncan Parkes, Tom Hughes and Andy Armstrong. The site is kindly hosted by <a href="http://www.mysociety.org">mySociety.org</a>. It searches as many local authority planning websites as it can find and emails you details of applications near you. The aim of this to enable shared scrutiny of what is being built (and <a href="http://www.urban75.net/vbulletin/showthread.php?t=154006" title="Death of the Queen">knocked down</a>) in peoples communities. | |||||
</p> | </p> | ||||
<h3 id="authorities">Planning authorities currently covered by the service</h3> | <h3 id="authorities">Planning authorities currently covered by the service</h3> | ||||
@@ -148,7 +148,6 @@ | |||||
} | } | ||||
$application->address = $parsed_application->address; | $application->address = $parsed_application->address; | ||||
$application->postcode = $parsed_application->postcode; | |||||
$application->description = $parsed_application->description; | $application->description = $parsed_application->description; | ||||
$application->info_url = $parsed_application->info_url; | $application->info_url = $parsed_application->info_url; | ||||
$application->comment_url = $parsed_application->comment_url; | $application->comment_url = $parsed_application->comment_url; | ||||
@@ -164,14 +163,27 @@ | |||||
$this->store_log("ERROR: Created blank comment tiny url"); | $this->store_log("ERROR: Created blank comment tiny url"); | ||||
} | } | ||||
if (isset($parsed_application->postcode)) { | |||||
//Workout the XY location from postcode | |||||
$xy = postcode_to_location($parsed_application->postcode); | |||||
$application->postcode = $parsed_application->postcode; | |||||
$application->x = $xy[0]; | |||||
$application->y = $xy[1]; | |||||
} | |||||
else if (isset($parsed_application->easting) && | |||||
isset($parsed_application->northing)) { | |||||
$postcode = location_to_postcode( | |||||
$parsed_application->easting, | |||||
$parsed_application->northing | |||||
); | |||||
$application->postcode = $postcode; | |||||
$application->x = $parsed_application->easting; | |||||
$application->y = $parsed_application->northing; | |||||
} | |||||
$application->info_tinyurl =$info_tiny_url; | $application->info_tinyurl =$info_tiny_url; | ||||
$application->comment_tinyurl = $comment_tiny_url; | $application->comment_tinyurl = $comment_tiny_url; | ||||
$application->map_url = googlemap_url_from_postcode($application->postcode); | $application->map_url = googlemap_url_from_postcode($application->postcode); | ||||
//Workout the XY location from postcode | |||||
$xy = postcode_to_location($application->postcode); | |||||
$application->x = $xy[0]; | |||||
$application->y = $xy[1]; | |||||
//Add to array | //Add to array | ||||
array_push($return_applications, $application); | array_push($return_applications, $application); | ||||
@@ -195,4 +207,4 @@ | |||||
} | } | ||||
?> | |||||
?> |