Pubs serving food, near to motorways

Introduction

The Good Pub Guide used to have a useful section for
places that you could get a nice dinner as an alternative to motorway service
stations. I wondered if it was possible to do the same thing using
OpenStreetMap data

Method

Settings used for this extract were:

Node with amenity=pub; food=yes

Within 7km of a junction

Not within 5km of the centre of a city

Not with 20km of the centre of a capital city

Within the "British Isles" area

Pubs (amenity=pub) can be marked in OSM as serving food (food=yes).
For the moment, I'm not considering cafes or restaurants.

Motorway junctions are marked in OSM (motorway_junction=[reference number]).
To find out which motorway they're on, one needs to store the node's ID, then
look at the roads (highway=motorway) to find one that goes past the junction.
If no motorway connects to the junction, it's probably on a trunk road,
e.g. the A421.

Cities are marked in OSM (place=city) and I've removed city-centre pubs to avoid
cluttering the map every time a motorway goes through a city. Also, London (capital=yes)
is treated as a larger area than regular cities.

Limitations

At the moment, this method won't detect pubs which are drawn as an outline area rather than a point

City limits are based on distance, rather than boundary polygons

Distances from junction to pub is "as the crow flies" — the program isn't currently integrated
with a routing engine to check the feasibility of driving from the junction to the pub.

Speed

Code

Implications for OpenStreetMap surveying

Hopefully projects such as this which give visibility to attributes such as food=yes
(and website=, telephone=) should lead to an increase in interest in tagging such features.

At the moment, the choice of pubs shown may be more indicative of their proximity to a
surveyor familiar with the food=yes tag than to the availability of good food.

In due course, the OpenStreetMap community may want to come up with additional attributes
to distinguish between good food and adequate food, provided it can be done in an objective
way (as opposed to reviewer's ratings) similar to the "real_ale" tag for classifying pubs.