Skip to content

Configuration examples

walkermatt edited this page Sep 29, 2011 · 30 revisions

Output to ESRI Shapefile

To output data in Shapefile format you will want to specify ESRI Shapefile in the OGR command, 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_osmm.prep_osmm_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=osmm_topo_shape_qgis.gfs

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.

VectorMap Local

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 and omit the gfs_file:

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

# Do not specify a .gfs file - let OGR create one for VectorMap Local
gfs_file=

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