@@ -1,4 +1,4 @@ | |||||
<?php /* Smarty version 2.6.16, created on 2007-04-09 18:29:17 | |||||
<?php /* Smarty version 2.6.16, created on 2007-04-09 18:50:08 | |||||
compiled from rss.tpl */ ?> | compiled from rss.tpl */ ?> | ||||
<?php echo '<?xml'; ?> | <?php echo '<?xml'; ?> | ||||
version="1.0" encoding="UTF-8"<?php echo '?>'; ?> | version="1.0" encoding="UTF-8"<?php echo '?>'; ?> | ||||
@@ -107,6 +107,18 @@ class api { | |||||
$this->applications = Applications::query_area($bottom_left_xy->easting, $bottom_left_xy->northing, $top_right_xy->easting, $top_right_xy->northing); | $this->applications = Applications::query_area($bottom_left_xy->easting, $bottom_left_xy->northing, $top_right_xy->easting, $top_right_xy->northing); | ||||
} | } | ||||
break; | break; | ||||
case "areaos": | |||||
//validation | |||||
if(!isset($_GET['bottom_left_easting']) || !isset($_GET['bottom_left_northing']) || !isset($_GET['top_right_easting']) || !isset($_GET['top_right_northing'])){ | |||||
array_push($this->warnings, "Bounding box was not specified"); | |||||
} | |||||
//all good, get the data | |||||
if(sizeof($this->warnings) == 0){ | |||||
$this->applications = Applications::query_area($_GET['bottom_left_easting'], $_GET['bottom_left_northing'], $_GET['top_right_easting'], $_GET['top_right_easting']); | |||||
} | |||||
break; | |||||
default: | default: | ||||
$this->warnings = "No call type specified"; | $this->warnings = "No call type specified"; | ||||
} | } | ||||
@@ -120,6 +120,7 @@ class Applications{ | |||||
//by area | //by area | ||||
function query_area($x1,$y1,$x2,$y2) { | function query_area($x1,$y1,$x2,$y2) { | ||||
$db = DB::connect(DB_CONNECTION_STRING); | $db = DB::connect(DB_CONNECTION_STRING); | ||||
$sql = "select council_reference, address, postcode, description, info_url, comment_url, map_url, x, y, date_recieved, full_name | $sql = "select council_reference, address, postcode, description, info_url, comment_url, map_url, x, y, date_recieved, full_name | ||||
from application | from application | ||||
@@ -65,8 +65,8 @@ | |||||
http://www.planningalerts.com/api.php?<strong>call</strong>=area<br/>&<strong>bottom_left_lat</strong>=[some latitude]&<strong>bottom_left_lng</strong>=[some longitude]&<strong>top_right_lat</strong>=[some latitude]&<strong>top_right_lng</strong>=[some longitude] | http://www.planningalerts.com/api.php?<strong>call</strong>=area<br/>&<strong>bottom_left_lat</strong>=[some latitude]&<strong>bottom_left_lng</strong>=[some longitude]&<strong>top_right_lat</strong>=[some latitude]&<strong>top_right_lng</strong>=[some longitude] | ||||
</code> | </code> | ||||
<p class="apiexamples"> | <p class="apiexamples"> | ||||
<a href="http://www.planningalerts.com/api.php?lat=51.52277&lng=-0.067281&area_size=l">view example</a> | |||||
<a href="http://www.planningalerts.com/api.php?lat=51.52277&lng=-0.067281&area_size=l">view on a map</a> | |||||
<a href="http://www.planningalerts.com/api.php?call=area&bottom_left_lat=51.52277&bottom_left_lng=-0.067281&top_right_lat=52.52277&top_right_lng=15">view example</a> | |||||
<a href="http://maps.google.com/maps?f=q&hl=en&q=http://www.planningalerts.com/api.php%3Fcall%3Darea%26bottom_left_lat%3D51.52277%26bottom_left_lng%3D-0.067281%26top_right_lat%3D52.52277%26top_right_lng%3D15&layer=&ie=UTF8&z=8&om=1">view on a map</a> | |||||
</p> | </p> | ||||
</div> | </div> | ||||