Working with the Hampshire Rights of Way open data

As you may have heard, recently Hampshire County Council opened up their rights-of-way data (see here) and published it under the OS OpenData licence. It’s looking good for the possibility of adding this to OSM though there seems to be one or two ODBL issues which need to be resolved so holding fire for the moment – though I’m somewhat inclined, if things drag on too long, to add it anyway with a clear “source=HCC” tag so it can be removed if it has to be.

But for the meantime I’ve been working with the data and have produced “OpenHants”, a simple prototype site which overlays HCC rights-of-way data on a kothic-js rendered OSM map (basically the Freemap map, minus the designation layer). This can be seen here; because it uses kothic-js (and therefore canvas) it requires an up-to-date browser, so old IE versions prior to 9 are out.

How was this done?

* The HCC shapefile was downloaded and reprojected to “Google Spherical Mercator” (not strictly necessary, but done for consistency) with ogr2ogr (GDAL conversion/transformation tool):

ogr2ogr -t_src EPSG:3857 Hampshire_RoW_BNG.shp Hampshire_RoW_sphmerc.shp

* The reprojected shapefile was converted to SQL suitable for PostGIS with shp2pgsql (postgis tool):

shp2pgsql -s 3857 Hampshire_RoW_sphmerc hampshire > hampshire_sphmerc.sql

* The data was imported into a PostGIS database.
* A PHP script was used to retrieve data by bounding box from the database as GeoJSON (see here); this actually shares code with Freemap as kothic-js also requires GeoJSON from the server.
* Leaflet was used to overlay the GeoJSON feed on the map (see here)

What I’m hoping to do as well is allow users to report problems in-the-field with a simple Android app. Mind you I’m also planning to work some more on a new mapsforge-based version of OpenTrail (Freemap Android app) so as always this will be dependent on having the time.

Comments are closed.