Browse Source

fixes to api

master
memespring 17 years ago
parent
commit
33fdb39001
4 changed files with 11 additions and 8 deletions
  1. +4
    -2
      docs/api.php
  2. +3
    -3
      docs/scrapers/cityoflondon.php
  3. +1
    -1
      docs/templates/apihowto.tpl
  4. +3
    -2
      docs/templates/rss.tpl

+ 4
- 2
docs/api.php View File

@@ -41,13 +41,15 @@ class api {
//Get OS ref from postcode //Get OS ref from postcode
if (isset($_GET['postcode'])) { if (isset($_GET['postcode'])) {
$xy = postcode_to_location($_GET['postcode']); $xy = postcode_to_location($_GET['postcode']);
$this->easting = $xy[0];
$this->northing = $xy[1];
} else { } else {
$latlng = new LatLng($_GET['lat'], $_GET['lng']); $latlng = new LatLng($_GET['lat'], $_GET['lng']);
$xy = $latlng->toOSRef(); $xy = $latlng->toOSRef();
$this->easting = $xy->easting;
$this->northing = $xy->northing;
} }


$this->easting = $xy->easting;
$this->northing = $xy->northing;
$this->area_size = $_GET['area_size']; $this->area_size = $_GET['area_size'];


$this->applications = Applications::query($this->easting, $this->northing, alert_size_to_meters($this->area_size)); $this->applications = Applications::query($this->easting, $this->northing, alert_size_to_meters($this->area_size));


+ 3
- 3
docs/scrapers/cityoflondon.php View File

@@ -15,13 +15,13 @@ if (isset($_GET['year'])){
} }


//search url //search url
$search_url = "http://www.planning.cityoflondon.gov.uk/dc/DcApplication/application_searchresults.aspx?searchtype=WEEKLY&selWeeklyListRange=#daterange&weektype=VAL";
$search_url = "http://www.planning.cityoflondon.gov.uk/PublicAccess/tdc/DcApplication/application_searchresults.aspx?searchtype=WEEKLY&selWeeklyListRange=#daterange&weektype=VAL";
$date_range = "{$day}%2F{$month}%2F{$year}%7C{$day}%2F{$month}%2F{$year}"; $date_range = "{$day}%2F{$month}%2F{$year}%7C{$day}%2F{$month}%2F{$year}";
$search_url = str_replace("#daterange", $date_range, $search_url); $search_url = str_replace("#daterange", $date_range, $search_url);


//comment and info urls //comment and info urls
$info_url_base = "http://www.planning.cityoflondon.gov.uk/dc/DcApplication/application_detailview.aspx?caseno=";
$comment_url_base = "http://www.planning.cityoflondon.gov.uk/dc/DcApplication/application_comments_entryform.aspx?caseno=";
$info_url_base = "http://www.planning.cityoflondon.gov.uk/PublicAccess/tdc/DcApplication/application_detailview.aspx?caseno=";
$comment_url_base = "http://www.planning.cityoflondon.gov.uk/PublicAccess/tdc/DcApplication/application_comments_entryform.aspx?caseno=";
//grab urls //grab urls
$applications = scrape_applications_publicaccess($search_url, $info_url_base, $comment_url_base); $applications = scrape_applications_publicaccess($search_url, $info_url_base, $comment_url_base);


+ 1
- 1
docs/templates/apihowto.tpl View File

@@ -2,7 +2,7 @@


<h3>PlanningAlerts.com API</h3> <h3>PlanningAlerts.com API</h3>
<p> <p>
Planning application data is available programmatically as <a href="http://georss.org/">GeoRSS feeds</a>. GeoRSS can be used in most all web mapping APIs and desktop GIS software, and in services like <a href="http://mapufacture.com">mapufacture</a> and <a href="http://pipes.yahoo.com/">Yahoo Pipes</a>.
Planning application data is available programmatically as <a href="http://georss.org/">GeoRSS feeds</a>. GeoRSS can be used in almost most all web mapping APIs and desktop GIS software, and in services like <a href="http://mapufacture.com">mapufacture</a> and <a href="http://pipes.yahoo.com/">Yahoo Pipes</a>.
<p/> <p/>


<p> <p>


+ 3
- 2
docs/templates/rss.tpl View File

@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:georss="http://georss.org/georss">
<rss version="2.0" xmlns:georss="http://www.georss.org/georss">
<channel> <channel>
<title>Search Results</title>
<title>PlanningAlerts.com</title>
<link>http://www.planningalerts.com/</link> <link>http://www.planningalerts.com/</link>
<description></description> <description></description>
{foreach name="applications" from="$applications" item="application"} {foreach name="applications" from="$applications" item="application"}
<item> <item>
<title>{$application->address}</title>
<guid isPermaLink="false">{$application->council_reference}</guid> <guid isPermaLink="false">{$application->council_reference}</guid>
<georss:featurename>{$application->address}</georss:featurename> <georss:featurename>{$application->address}</georss:featurename>
<georss:point>{$application->lat} {$application->lon}</georss:point> <georss:point>{$application->lat} {$application->lon}</georss:point>


Loading…
Cancel
Save