Pezholio

Mashing Up Planning Data With Google Maps

| Comments

Planning Alerts LogoAsk a council webmaster what service gets used on their site the most, and I’ll bet you £10 they’ll say ‘Planning’. Planning is one of the most controversial subjects that councils (particularly shire districts) have to deal with and almost all councils publish planning application data on their websites.

The trouble is, a lot of this is locked away in ugly, unusable systems that the public hate using (See the star rating of our planning search pages for proof of this), so any opportunity to make getting access to planning data has to be welcomed.

Step forward the lovely people at Planning Alerts. These guys (a lot of whom are on the MySociety dev team, responsible for the lovely FixMyStreet and TheyWorkForYou sites) have built a system that ‘screen scrapes’ planning data from over 250 authorities and lets residents sign up for alerts on planning applications in their area.

As well as this, they also have an API ,which returns the data that they’ve lovingly screen-scraped using all manner of clever scripts in a format that anyone can use, you can get data from a single location (be it postcode, latitude / longitude, or even easting and northing) as well as data for an entire authority. It’s this data that we’re going to use for our mashup.

First, check that your council is covered, if it’s not, then get in touch with the Planning Alerts team and there might be someone who can help. If you’re particularly technical, you might even want to write your own screen-scraper (which is what I did)

Once, you’ve got your council, it’s time to grab a feed. Feeds are returned in this format:

http://www.planningalerts.com/api.php?**call**=authority**authority**=[some name]

So, for example, to get the Scottish Borders data, the feed url is

http://www.planningalerts.com/api.php?call=authorityauthority=Scottish%20Borders

Try it with your council and check it works. Make sure you replace any spaces with ‘%20’

If the feed is working, now you can use the Google Maps API to display the latest planning applications on your own site.

Firstly, sign up for a Google Maps API key (if you haven’t done already) and put the relevant code in your header:

script src="http://maps.google.com/maps?file=apiv=2key=[your api key here]" type="text/javascript"/script

Then, it’s a simple case of sticking the following code below (in the section as before):

`

var map;

var geoXml;

geoXml = new GGeoXml(”Put your GeoRSS url here”);

function initialize() {

if (GBrowserIsCompatible()) {

map = new GMap2(document.getElementById(“rss_map”));

map.setCenter(new GLatLng(0, 0), 2);

map.addControl(new GLargeMapControl());

map.addControl(new GLargeMapControl());

map.addOverlay(geoXml); }

}

`

And, ta da! There you have it, a Google Map of planning applications for your council, it really is that simple!

This approch works for all geoRSS feeds, so if you’ve got any more feeds in that format, you can do exactly the same thing (I’ve done something similar for food safety scores on the Ratemyplace site)

There is one teeny problem, often it can take a few seconds to load the data, stay tuned for part 2 and I’ll let you know how to combat this!

Mashing up planning data with Google Maps - Part 1.5

Comments