Home News using Ordnance Survey data

using Ordnance Survey data

By Graham Asher on 11 June 2010

The Ordnance Survey, Britain's national mapping agency, have recently made some data public under a very liberal license. CartoType can now make use of this data.

We've worked with two types of data so far: UK postcodes and local vector map data. Here's how it's done. You'll need the latest version of generate_map_data_type1.exe, downloadable from here.

Adding UK Postcodes to CartoType maps

Download the postcode data as CSV files from the Ordnance Survey site. For example, the data for the BA postcode is in ba.csv. Concatenate as many of these files as necessary to make a single file. Then all you need to do is add the new command-line option

/input=ba.csv

(substituting the actual name of your csv file) to the command line for generate_map_data_type1.

The postcodes are inserted into the map as point objects in a new 'postcode' layer. They are available for searching, and can optionally be displayed; you'll probably want to display them only when showing search results.

Converting Ordnance Survey vector data to CartoType maps

Download OS VectorMap District data from the Ordnance Survey site; for example, the data for the national grid square SP will (after you have unzipped it) be in a directory called "OS VectorMap District (Vector) SP", and within that the data for each 10km by 10km square will be in a subdirectory called \data\SP\SPnn, where nn is the number of the small square.

You now need an XML control file to tell generate_map_data_type1 what to do. This file is a good start; you may want to modify it. Put the file in the \data\SP\SPnn directory, go to that directory, and run this command from there:

generate_map_data_type1 /project=utme /res=6 os-vector-map-district.xml my-map.ctm1

(substituting your preferred output file name for my-map.ctm1).

Here's an example:

map of part of Oxford generated from Ordnance Survey data

Coming soon: I'll describe how to add selected layers of Ordnance Survey data, such as buildings, to maps created mainly from OpenStreetMap data.