Os tools for os

This page is intended as a central location for ideas feeding into creating open source tools for interacting with Ordnance Survey data / products.

Astun Technology, Faunalia and Dauntsey Parish Council are working on a set of tools to convert Ordnance Survey's GML based data sets to PostGIS or Shapefile.

OS MasterMap loader
A Simple script for loading OS MasterMap into a variety of formats including PostGIS, Shape, TAB etc. Written in Python and based on OGR.

Source code and download available on GitHub: https://github.com/AstunTechnology/osmmloader

Future enhancements

 * 1) Managing Change only Updates in PostgreSQL
 * 2) Creation of a classification column to make styling features easier
 * 3) SLD and .map files to style the data
 * 4) Provide support for profiles of the data tailored to use with specific software such as QGIS and format (Shape, PostGIS etc.)

OS OpenData loader
A nice typical process for users to download OpenData would be:


 * 1) Select the required data from the OS OpenData download page, enter details and wait for email
 * 2) Paste contents of email into QGIS plugin
 * 3) The plugin downloads all necessary files mentioned in email and processes them

The data processing would generally consist of unzipping the data into a data type specific subfolder of the users’ "OS Data Library" and then doing some data specific pre-processing

An even better alternative would be an alternate OS interface that would allow the user to select an area of the UK (draw a polygon as for PSMA), select the layers wanted, agree the licence, then transfer (FTP) to local machine. The next stage would be to unpack the used files into a standard directory structure, ready for subsequent use.

QGIS Plugins
Feel free to add possible features here for a QGIS plugin to allow users to easily interact with OS products

Data specific pre-processing
The following tasks would be carried out on various different data types during the import process

Vector data
The following are changes to the GML/GZ data such as used for MasterMap. With these changes, QGIS can style text in the "standard" OS manner.


 * Translate OS "orientation" field (integer angle in 1/10 degrees) to "angle" as a float. [angle = orientation / 10]
 * Translate OS "font" field (integer in the range 0 to 3) to "qfont" as a string. [The string value is the name of the font on the local PC]
 * Translate OS "anchorPosition" (integer in the range 0 to 8) to "qPosition" as a string. [The string value is the QGIS position string, e.g. Above Left]

For OpenData, the VectorData District technical specification says that the data is in GML 3.1.1, but it is actually delivered as shapefiles. VectorData Local is however supplied as GML (GZ), but specified as 2.1.2.


 * "ORIENTATIO" always seems to be zero - should we just remove the attribute? It is also described in the VectorData District technical specification as being 0-359, so is different from the
 * "FONTHEIGHT" is described as points rather than map units for MasterMap. Simply using these values as map units results in too small text - possibly scale them?
 * "FONTCOLOUR" is a numeric field. The technical guide specifies standard colours, so these could sensibly be translated to standard QGIS colour strings. [1 = Black, 2 = Blue, 3 = Green, 4 = Dark Blue]
 * "FONTTYPE" is a numeric field giving an indication of possible font style. This could also be translated to a string specifying a local font. [OS suggestions: 1 = Corbel, 2 = Corbel bold, 3 = Arial]

Raster data

 * Create new or update existing .VRT layer of the raster tiles (VRTs are virtual raster layers that make multiple tiles look like one big tile)
 * Create new or update existing vector coverage layer (the vector coverage layer could be a square for each downloaded tile with an action set to open the given tile when a user clicks on it)
 * Image pyramids?

PostGIS Support
Would be nice:


 * Plugin sets up a PostGIS database easily without much user intervention
 * Plugin imports data (probably in chunks) into the database, taking care not to make duplicate features
 * Plugin handles change only updates
 * Plugin handles spatial index creation and database maintenance

General
Plugin keeps track of the last time each dataset was updated and possible lets the user know when updates are available

Ability to "backup" the library and settings, allowing the dataset to easily be transferred to another machine

Style Library
Some central (user contributed) library of styles to get people going.

Grid Library
Basic vector grids to help users find their way around OS tile areas.


 * 1km x 1km grid
 * 10km x 10km grid
 * 100km x 100km grid

Print Composer Template Library
A few basic templates to get people going with OS acceptable copyright text already included. Say A4 though A0 in both landscape and portrait formats.

Other

 * A gazateer plugin to be able to easily type in a place name to get QGIS to zoom to that location