Since Astun Technology has quite a geographically distributed workforce (OK, we are all in the UK, but still), we make the effort to get together every three months or so for meetings, merriment, and some geeky hacking. Our “hackastun” events are a great chance for those of us who deal more with the finished software to do a bit of coding, even if it is just messing around with python.

For our most recent hack, I had a goal of investigating how we might start integrating some interesting new APIs with our software, iShare. This would use a relatively new feature in iShare, called Dynamic Datasources. These do exactly what they say on the tin, and allow us to call external datasources at the time the iShare page is loaded, to get up to date information.

My hopefully willing accomplice was new Astun hire (but not new to open source Geo) Ian Turton. As is traditional with these things, the first half of the hack was spent doing some serious yak-shaving getting a working iShare development environment set up on his linux laptop. However, contrary to other hacks, once we got that set up, progress was swift.

The first API we looked at was the UK Transport API. Developing a script to pass a unique property reference number (UPRN) from iShare, convert it to a Latitude/Longitude string, send it to the API and return the nearest bus stops was pretty easy- we used pyproj to convert a British National Grid Easting/Northing to Lat/Lon, and Untangle to wrangle any XML we came across.

The next stage for this will be to extend the script to make a second call to get the bus timetable for the stops. Train and tube information are also available from the API, as well as some journey planning, so no doubt we’ll be exploring this API further.

On the train on the way home I also looked at the What3Words API to see how straightforward it would be to work with. It turns out that it’s pretty easy, even for an entry-level pythonista like myself, so now we can offer the What3Words address for a given property in iShare.

It’s important when working with APIs to assess their resilience and sustainability, you don’t want one that you’re relying on to close down suddenly. It should also use open standards, of course. However, I think they are becoming increasingly important as they reduce the need for people to hold, manage and update the data themselves, which is a big plus from an Astun/iShare perspective. They are also a lot of fun to work with, if you’re a geo-geek!