Tool for converting citylines geoJSON dumps into OSM XML files.
Clone/download this repository, install pipenv, and run:
pipenv run python citylines2osm.py <sections GeoJSON file> <stations GeoJSON file> <lines JSON file> <outfile.osm>
Then, you can open the osm
file from editors such as JSOM.
Note: Citylines2osm currently only considers features not originally imported from OSM.
The main rule that this tool follows is that sections are turned into ways, stations are turned into nodes, and lines are turned into relations.
For each way (section), the following tags are set:
citylines:id
, with the original citylines idnetwork
, equal to the system name
For each station node, the following tags are set:
citylines:id
, with the original citylines idnetwork
, equal to the system namename
, with the station namepublic_transport=stop_position
For each relation (line), the following tags are set:
name
, which equals to System + Line nametype=route
public_transport:version=2
The members of the line relation are the ways and the stations' nodes. Each node has the role stop
.
Besides these tags, transport mode-specific tags are added. You can see them in lib/transport_modes.py
Note:
- If the feature already had OSM tags, they will be kept.
Run:
pipenv run python -m unittest