Plotting Historical Parking Data Using Angular and NVD3

I was looking for a good and free charting component I could use in Angular. I’ve played around with some raw D3 in the past but I didn’t want to re-invent the wheel that much. Fortunately I found the NVD3 library which works on top of D3 to simplify common charting tasks line line charts, bar charts, etc and, even better, somebody’s already created an Angular directive on top of that.
…click here to read the rest…

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…

Scraping the IKEA API in PHP

IKEA’s BILLY bookcase 80x28x106cm in birch veneer. A design classic. £45 for the everyman’s unobtrusive storage solution. Over 40 million BILLY bookcases sold since they were created in 1979. But how many of them are there in the my local branch of IKEA at the moment?

billy-bookcase

Not the most important question in the world but a useful one to do a quick demo of how to automatically pull data out of an API in PHP at a regular interval and store it in a database (MySQL in this case) – something that we commonly want to do to compile data-sets where live data readings are provided but historical data is not.

Where is my data?

The first thing to know is where we can get our live data. In the case of the IKEA website, there is a live stock check in the right hand column where you can select a particular store and see availability for the selected product. Here’s the location of the birch veneer BILLY bookcase on IKEA’s website: http://www.ikea.com/gb/en/catalog/products/80279786/. Note that final 8 digit number – that’s our unique product ID.
…click here to read the rest…

Drawing Better Graphs – Have Your Data Tell the Story

Graphs are supposed to communicate data in a meaningful way. That’s the whole point. But too often people miss the opportunity to create graphs that effectively communicate the story they want to tell in a way that’s both easily readable and aesthetically pleasing. In this time of decreasing attention spans, quickly and effectively telling the story of your data has never been more important.

So let’s take an example narrative and look at how we can create a better graph to get our message across. I’ve got some nice data about the usage of Bristol car parks we can use as an example. I have a hunch that Cabot Circus car park (very large capacity and primarily used by shoppers) has a lot of spare capacity that could be better used during weekdays so here’s my message.

Cabot Circus car park is underutilised in the week and they should offer reduced rates to office workers Monday to Friday to monetise that spare capacity.

Let’s start by plotting all the car park data I have for Bristol and Bath car parks for a single weekday using Excel’s default line plot…

carparkplot1

(Of course if I was actually making the case for this I’d be using averaged and max/min data rather than a single day but this post is about charting not data usage so bear with me)

A pretty messy plot. We can find Cabot Circus’s data in there but we have to work for it.
…click here to read the rest…

Know Your Place, Bristol!

I stumbled upon this hidden away little BCC project yesterday called Know Your Place.

It’s actually two projects in one:
1. An interactive map viewer where you can compare a current map to historical maps
2. A map-based database of site of historical interest and geo-located historical photos

I lost track of quite a long time looking around at how parts of Bristol have changed over the years! Here’s an example looking at Queen Square:

This slideshow requires JavaScript.

I knew there was once a road going diagonally through Queen Square but I always wondered what they did about the statue. Now I know – they bent the road around it on each side. Obvious really.

That 1880s map is a work of art.
…click here to read the rest…

State of the City

While I was searching around for some city population data yesterday, I came across the document “Bristol State of the City mid-2015” (PDF link) which has some data “fun facts” about Bristol.

Here are a few I found interesting so putting them down for future reference:

  • More than 180 countries of birth and 91 languages spoken (Census 2011)
  • Life expectancy for women is 0.3 years below the national average but for men is 1.2 years below the national average (ONS 2011-2013)
  • 59% of Bristolians are overweight or obese
  • ~35,000 full time students live in Bristol during term time
  • 46% of working aged residents have at least one degree (compared to 36% nationally)
  • Bristol residents are more highly qualified than all the other Core Cities except Cardiff and is the third strongest academic cluster in the UK (after Oxford and Cambridge)
  • 193,000 homes (in 2014) – 55% owner-occupied / 24% private rented / 21% social rented
  • Average house price was £198,600 in Feb 2015 (Rightmove suggests it’s 8% higher than that now at around £215,500)
  • 93 crimes reported per 1000 people
  • 14.5mph is the average speed of traffic in rush hour
  • 45% of household waste is recycled (In 2010 it was only 8%)
  • 71% of residents are concerned about the impacts of Climate Change
  • 70% of shops, cafes, restaurants, pubs are independent
  • £B 350,000 of Bristol Pounds in circulation
  • 40% of the world’s wildlife films are linked to Bristol studios
  • 217,300 people are in employment in Bristol – an employment rate of 70.9% (Dec 2014)

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 Exercise Insights from the Strava Global Heatmap?

Strava, a popular GPS run / ride tracking app, have compiled their data into a beautiful Global Heatmap showing the preferred paths of runners and cyclists around the world.

I, of course, have been taking a zoomed in look at Bristol to see what we can learn.

Here are the cycling and running GPS tracks through central Bristol. Single tracks are thin blue lines then as more tracks stack up on a route you get a thicker blue line and then a red thick line for the most common routes.

Cyclists

Strava Bristol Bikes

Runners

Strava Bristol Runners

Here are some interesting features I found:
…click here to read the rest…

Which generation is winning on income? – data insights from the Guardian

Some really interesting data visualisations from the Guardian in their article here that’s part of their series on millenials.

You can enter your age and country and it will tell you on average whether you’re better or worse off than your equivalents in the past and in different countries.

Helpfully they also take that 2d matrix of combinations and plot all the possibilities in a single view like the below which really neatly gives you the full overview in a single screen-sized chunk. Each plot represents income (or possibly disposable income – it’s not clear from the site) from 1979 to 2010 with green representing groups that are now better off and purple those that are now worse off.

disposable income by age and country

It’s a shame the data doesn’t extend to 2016. It’s a really interesting view on some of the real effects of recent economic events across the globe and how their impacts are shared across different age-groups in the same society (spoiler alert: they’re not shared evenly!).

In only one country are under-30s better off now than they were in 1979. That’s crazy!
In the UK particularly, things have been getting a lot worse for under-30s and a lot better for the over-60s. Maybe the state pension pot should be going to help the young rather than the old!
Something’s not right but maybe it’s down to that age-old problem – young people don’t vote, older people do.