Skip to content

Configuration examples

Matt Walker edited this page Nov 5, 2013 · 30 revisions

Output OS MasterMap Topo to ESRI Shapefile with QGIS attributes

To output data in Shapefile format you will want to specify ESRI Shapefile in the OGR command and if loading OS MasterMap there is an alternative prep_cmd to prepare the data and an accompanying gfs file to specify attributes and their names:

# Specify ESRI Shapefile as the format that ogr2ogr should output to and
# use the $output_dir token to specify the folder that the Shapefiles will be written to
ogr_cmd=ogr2ogr -append -skipfailures -f 'ESRI Shapefile' $output_dir $file_path

# Use the Use the Sharefile / QGIS specific preparation routine
prep_cmd=python prepgml4ogr.py $file_path prep_osgml.prep_osmm_topo_qgis

# Use the Sharefile / QGIS specific gfs file which specifies short column names,
# list attributes such as Descriptive Term as a comma separated list and some QGIS
# specific attributes for displaying labels
gfs_file=../gfs/osmm_topo_shape_qgis.gfs

VectorMap Local to PostgreSQL/PostGIS

Currently there is basic support for loading OS VectorMap Local with no value add. To load VectorMap Local you need to specify a suitable prep_cmd to prepare the GML for loading specify a suitable gfs file:

# Use the basic GML preperation routine
prep_cmd=python prepgml4ogr.py $file_path prep_osgml.prep_vml

# Use the specific VML gfs file tailored to loading into PostgreSQL
gfs_file=../gfs/vml_postgres.gfs

AddressBase Premium to PostgreSQL/PostGIS

In order to load Ordnance Survey AddressBase Premium data you must use the appropriate prep command to prepare the data for loading and associated gfs file:

# Use the OS AddressBase Premium preperation logic
prep_cmd=python prepgml4ogr.py $file_path prep_osgml.prep_addressbase_premium

# OS AddressBase Premium gfs file to specify appropriate schema for the data
gfs_file=../gfs/addressbase_premium.gfs

The preperation involves:

  • Splitting out the various features that relate to the main BasicLandPropertyUnit and Street tables into standalone tables with either UPRN or USRN columns to allow them to be joined, only the BasicLandPropertyUnit and Street tables have geometry
  • Converting Street geometry to MultiPoint where the first point is the start point for the Street and the second is the end point

Output to MapInfo TAB

To output data in MapInfo TAB format you simply need to specify MapInfo File as the format in the OGR command:

# Specify MapInfo File as the output format
# and use the $output_dir token to specify the folder that the Shapefiles will be written to
ogr_cmd=ogr2ogr -append -skipfailures -f "MapInfo File" $output_dir/$base_file_name $file_path

Note: OGR does not support updating / appending to MapInfo TAB files so you may want to use the $base_file_name to specify a folder in which to write the output for each source file as shown above. The individual tables can then be stitched together for display using a seamless table.

Paths on Windows

When specifying paths for the src_dir, tmp_dir etc. on Windows it should be fine to simply use a single backslash to separate the parts of the path such as: C:\Temp. However when specifying paths for the ogr_cmd or prep_cmd you should escape the backslashes to ensure that the correct path is used, so instead of C:\Temp use C:\\Temp (use two backslashes).

Clone this wiki locally