| @@ -1,4 +1,4 @@ | |||||
| <?php /* Smarty version 2.6.16, created on 2009-07-13 11:56:29 | |||||
| <?php /* Smarty version 2.6.16, created on 2009-10-05 13:50:52 | |||||
| compiled from index.tpl */ ?> | compiled from index.tpl */ ?> | ||||
| <?php $_smarty_tpl_vars = $this->_tpl_vars; | <?php $_smarty_tpl_vars = $this->_tpl_vars; | ||||
| $this->_smarty_include(array('smarty_include_tpl_file' => "header.tpl", 'smarty_include_vars' => array())); | $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-07-13 11:56:29 | |||||
| <?php /* Smarty version 2.6.16, created on 2009-10-05 13:50:52 | |||||
| compiled from header.tpl */ ?> | compiled from header.tpl */ ?> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||||
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||||
| @@ -297,15 +297,20 @@ function scrape_applications_islington ($search_url, $info_url_base, $comment_ur | |||||
| $clean_postcode = strtolower($postcode); | $clean_postcode = strtolower($postcode); | ||||
| $clean_postcode = str_replace(" ","+", $clean_postcode); | $clean_postcode = str_replace(" ","+", $clean_postcode); | ||||
| $url = "http://www.streetmap.co.uk/newsearch.srf?type=Postcode&name=" . $clean_postcode; | |||||
| $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]; | |||||
| $headers = get_headers($url, 1); | |||||
| $location = $headers["Location"]; | |||||
| $location_regex = "/x=(\d*)&y=(\d*)&/"; | |||||
| $LatLng = new LatLng($lat, $lng); | |||||
| $OSBG = $LatLng->toOSRef(); | |||||
| preg_match ($location_regex, $location, $matches); | |||||
| $return = array($OSBG->easting, $OSBG->northing); | |||||
| return array_slice ($matches, 1); | |||||
| } | } | ||||
| function location_to_postcode($easting, $northing) { | function location_to_postcode($easting, $northing) { | ||||
| @@ -32,17 +32,26 @@ class preview_page { | |||||
| if (!isset($_GET['area_size'])){ | if (!isset($_GET['area_size'])){ | ||||
| $this->warnings .= "No area size specified "; | $this->warnings .= "No area size specified "; | ||||
| } | } | ||||
| if ($this->warnings == ""){ | |||||
| 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]; | |||||
| //Get OS ref from postcode | //Get OS ref from postcode | ||||
| $xy = postcode_to_location($_GET['postcode']); | $xy = postcode_to_location($_GET['postcode']); | ||||
| //Get the centroid long / lat (google maps doesnt handle grid refs) | //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; | |||||
| //$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) | //get long lat for the bounding box (OS grid refs are in meters in case you were wondering) | ||||