West Yorkshire GeoJSON
Since I started at ODI Leeds, I've been involved in quite a few projects that use geographic data. I'm not a geographer. My background is in astronomy so I have a little bit of experience with mapping but facing out into the cosmos rather than looking down at the surface of the Earth. That means I'm used to dealing with coordinates and data but had little knowledge of GIS software.
Many of our projects are visualisations on the web so I've had to get familiar with web-friendly geographic data. That generally means either KML or GeoJSON. My preference has been GeoJSON because it has been much quicker for me to make use of in web pages. It is also fairly easy to write code to convert a CSV file (that has coordinates as fields) into an array of GeoJSON place markers.
One project I worked on was about improving allotment data. I decided to do this by adding information (mostly allotment names) from open datasets directly to Open Street Map. I even walked around one of my local allotments with a handheld GPS to add it to the map. Part of doing this was to avoid creating my own data silo that would add to the effort needed by others to find the data and work with it.
Adding data to Open Street Map is one thing but I really wanted to be able to get data back out. OSM have an API but it's a bit involved and really needs a live internet connection which wasn't as useful for offline development. I found that GeoFabrik produce daily OSM extracts for West Yorkshire (as well as for many other regions). This was perfect as I'd be able to automatically grab the latest data every day.
GeoFabrik provide OSM files and Shapefiles but no GeoJSON. The missing step was finding GDAL's
ogr2ogr. This is a command line tool that can be used to manipulate standard geographic files. If you have a
west-yorkshire-latest.osm.pbf file you can extract all the points from it into a GeoJSON file (here,
west-yorkshire-latest.points.geojson) using e.g.:
ogr2ogr --config OSM_CONFIG_FILE osmconf.ini -f GeoJSON west-yorkshire-latest.points.geojson ./west-yorkshire-latest.osm.pbf points
Similar commands can be used to extract
other_relations. I then wrote some perl code (don't sue me) to read these five files and spit out new GeoJSON files based on the theme of the data rather than if it was a point, line, or polygon. The result is a bunch of files that are, individually, much more manageable and more useful. With themed data it is easier to spot when people have used deprecated tags such as gym or to find unexpected data such as the fact there are (at least) two vineyards in West Yorkshire.
Rather than just have these GeoJSON files available within ODI Leeds we've put them in a Github repository that will update automatically every day. This stops us being a gatekeeper of data; anyone can take the data and make their own visualisation of whatever interests them.
To be helpful, we also have sub-directories with breakdowns for Leeds, Bradford, and Calderdale created by clipping the West Yorkshire dataset with GeoJSON boundaries from Open Data Communities. I'm using these extracts to drive our Drinking Water map of Leeds. If you know of any missing drinking water fountains, you can add them to Open Street Map and they'll turn up on our visualisation. Of course, the data are open (both in being available and clearly licensed) so you could make your own visualisation too.
Hopefully developers will find these GeoJSON extracts useful. If you do, let us know.
ODI Leeds Data Projects