Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

GTFS shape mapfit

Fits GTFS shape files to a given OSM map file. Uses pymapmatch for the matching. Quite accurate, but very slow.


Copyright 2013 Jami Pekkanen (with dots at, released under AGPLv3 license.


What pymapmatch needs and argh for argument parsing. Matplotlib for visualization of the results. Pymapmatch is included as a submodule.

Linux. May work on other unix-like systems. Does not work on Windows due to some library dependencies not supporting the platform.


git clone --recursive


NOTE: The current implementation is mostly done with a specific fit to city of Tampere's data in mind. In practice if you want to use this program, it's best to contact the author.

You'll need a OSM export in XML or PBF format for the area covering the wanted shapes, referred in examples as map.osm. Due to some naive choices in current implementation, the map size affects fitting times very strongly. Expect many minutes per one shape. The initial loading also takes quite a while as it generates a graph from the map and R-tree from the edges.

At the moment the map projection used is also hardcoded in, so you'll need to change it if you are doing the matching anywhere but in Finland.

The fitting is usually done in two stages, first the fits are made with some included statistics and stored in a pickle.

./ process map.osm < shapes_orig.txt > fits.pickle

The results can be visualized with some statistics:

./ view map.osm < fits.pickle

And exported to a new shapes.txt:

./ export map.osm < fits.pickle > shapes_fitted.txt

With -n flag to the export command the file will also include the OSM node ids for the shape points under column node_id.


Many. If any of the measurements aren't in the search radius (default 50m) away from the right road, the results can be very bad. The radius can be increased with the -s parameter, but note that this dramatically increases the runtime. You can select only a subset of shapes to fit with the -w parameter, which is especially useful if only some shapes need a larger search radius.


No description, website, or topics provided.






No releases published


No packages published