“No ‘Access-Control-Allow-Origin’ header is present” error

When trying to create API endpoints in PHP you might get an error message like this if you’re trying to access it from you development environment or a different machine:

XMLHttpRequest cannot load http://xxxxxx.com/yourpage.php. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://xxxrequestoriginxxx.com’ is therefore not allowed access.

Sounds complicated but the fix is usually simple, just add the following at the start of your php code:

header("Access-Control-Allow-Origin: *");

// All the rest of your code


The OpenStreetMap Geocoding API

It’s pretty common that we want to convert between a given address or postcode, a lat/long coordinate or a place name. For example to show the user’s current city or town we’d need to get their lat/long from their browser through the HTML Geolocation API and then we’d need to somehow work out what town or city that corresponds to. Or to search on a map for a certain town or city, we need to convert that into coordinates that we can use to set our map centre.
…click here to read the rest…

The Bristol API

Bristol wants to become a “programmable city” and right at the end of last year Bristol City Council unveiled The Bristol API. Let’s take a look…

Bristol programmable city

The Bristol API

In 2015 Bristol City Council’s City Innovation team appointed the London-based software company Urban Things to build an API to give developers access to transport data for Bristol in real time (plus some other nice features like route planning).

It looks like a dig at the council to mention that the company hired to do this was a London company when I’m sure there are plenty of companies in Bristol that could have delivered this but actually Urban Things already have good experience and an established platform for managing bus data so hopefully BCC got a good price with our tax money because of that!

And, dear citizen, you can get access to the Bristol API here for free so don’t say the council never give you anything back!

…click here to read the rest…

Bristol Data Portals and Technology Companies

An attempt to compile a list of the player in Bristol’s open data landscape and other interesting data sources and companies:

Bristol Data

Bristol City Council Open Data Bristol – BCC putting their data out there
Connecting Bristol – Bristol’s digital partnership coordinated by the BCC’s City Innovation Team
Bristol Is Open – a joint venture between University of Bristol and BCC
Bristol API Portal by Urban Things – Bristol Transport data API
Bristol Pinpoint map – a load of GIS data. Not sure if underlying data is available though.
Bristol Air Quality Data – Air quality measurements from around the city

Useful APIs / Data

Forecast.io – Weather data API
UK-AIR – Live UK air quality data from DEFRA
EEA Air Quality Portal – Europe air quality data (live data map)
Open Street Map Geocoding API – convert Lat/Long coordinates to place names and place names to coordinates

Other Cities

Leeds Data Mill
London Data Mill
Bath: Hacked


WindyTy – hypnotic animated wind and weather forecast visualisations