VMD plus LFP plus OSM

From OpenStreetMap Wiki
Jump to navigation Jump to search

This page details an experiment (no longer available live on the web due to disc space constraints) to combine OS Vector Map District (VMD), LandForm Panorama (LFP; contours) and OSM footpath data to produce an open 'Landranger style' map. Note that if you wish to replicate this you will have to edit the source code to change paths for your system; consider all the software written for this experiment as 'researchware' rather than production-ready. It is however all open source (GPL) and can be checked out using SVN from:

svn://svn.free-map.org.uk/svn/freemap

Overview

The general technique followed was:

  • LFP contour data (.dxf) was imported into a PostGIS database on a home computer using a custom C++ command-line application;
  • A second custom C++ application (Mapnik-based) was written to load in the VMD raster tiles and render the contours stored in the PostGIS database on top of them;
  • The resulting VMD+LFP tiles (10x10km; 4000x4000 pixel) were uploaded to a server and split into 1x1km, 400x400 pixel tiles using a simple PHP script;
  • The 400x400 pixel tiles were resized down to 200x200;
  • A custom Mapnik-based CGI application was written to combine the VMD+LFP tiles with OSM footpath data stored in a PostGIS database on the server.

Importing the LFP data

The LFP data was imported into a PostGIS database using the procedure here .

Combining the LFP and VMD data

A custom application, using Mapnik and GD, was written to load in the VMD raster tiles (pre-converted from TIF to PNG) and render the LFP contour data on top of them. This is available here; the Mapnik XML file used can be seen here

Splitting up the LFP+VMD tiles

The VMD tiles are provided as 10x10km, 4000x4000 pixel tiles. Each was split into 100 1x1km, 400x400 pixel tiles using the PHP script here. The 400x400 pixel tiles were resized to 200x200 using ImageMagick.

Producing the web application

The tiles were numbered in the format easting/northing.png where easting and northing are measured in km, using the standard OS values (e.g square SU8928= easting 489, northing 128) and a Mapnik-based CGI application was written to render OSM footpath data (from a PostGIS database on the server) on top of the tiles. This is available here; the Mapnik XML file can be seen here. The OpenLayers code to produce a slippy map can be seen by viewing the source on the web page here.

Concluding comments

The end result is reasonable though it is a shame that the VMD data does not include service roads; the result is often that footpaths disappear in thin air close to a road due to a missing service road. Also the experiment *only* includes paths tagged with a designation tag, or, alternatively, foot=permissive; all other paths and tracks are, for the moment (due to inability to import using osm2pgsql as a result of server memory constraints) ignored.