Naptan2osm

From OpenStreetMap Wiki
Jump to navigation Jump to search

naptan2osm is a tool written in python to convert NaPTAN XMLv2 data to the OSM XML data.

Usage: parse.py [args] naptan.xml

Options:
 --version             show program's version number and exit
 -h, --help            show this help message and exit
 -f FILTER, --filter=FILTER
                       Only import Points matching FILTER. FILTER is in the
                       form element:value
 -o OUTFILE, --outfile=OUTFILE
                       Write OSM data to OUTFILE. Defaults to filename.osm

For example, to extract data for Birmingham from the West Midlands NaPTAN file, you'd use:

./parse.py -f Town:Birmingham -o naptan-birmingham.osm NaPTAN430.xml

The -o option is only used in this case, since we want to name the output file something other than NaPTAN430.osm.

Source in SVN.

You also need the file osmparser.py from the SVN. This file need to be placed in a directory called osmparser which must also contain an empty file called __init__.py.