[Imports] Some tools to help community-driven imports

Guillaume Pratte guillaume at guillaumepratte.net
Sun Dec 7 05:51:11 UTC 2014


Hello,

I am writing about the City of Montreal open data community-driven import. This email is not a formal request for discussion about this import (a subsequent email will be sent to this list, and it is important to say that the import has not started yet), but a mail about some new tools I and others have made to facilitate community-based import of data into OpenStreetMap.

These tools cover converting .csv files to .osm files and splitting .osm files for the Tasking Manager. The code is available in the following GitHub project:

  https://github.com/OsmQc/mtl2osm

See this post for all the details:

  http://www.openstreetmap.org/user/Zethradon/diary/28183

I’ll skip most of the post to cover the main points I would like to share with the mailing list.

## csv2osm: a tool for converting .csv files

As ogr2osm cannot easily read .csv files as an input, I wrote a script that is similar to ogr2osm and provide the same translator concept, and works exclusively for .csv files. The script is called csv2osm and can be found here:

  https://github.com/OsmQc/mtl2osm/blob/master/mtl2osm/csv2osm.py

Translators for this script have the same entry point as ogr2osm (the filterTags function). For example, Montreal's open dataset for bike parkings is provided as a .csv file. The translator I wrote for this dataset parses the description of each bike parking to extract the capacity and provides the following tags for each points.

  https://github.com/OsmQc/mtl2osm/blob/master/mtl2osm/donnees/arceaux-a-velos/traducteur-arceaux-a-velos.py

Instructions on using the script is available here:

  https://github.com/OsmQc/mtl2osm/blob/master/mtl2osm/donnees/arceaux-a-velos/


## Splitting .osm files for the HOT Tasking Manager

We are planning to use the HOT Tasking Manager for our import. To ease importing the generated .osm dataset into JOSM (for manual reconciliation with OSM data), we had to write a script that splits the .osm files into a series of sub-files, one per sub-task. Essentially the .osm file is split-up according to a grid defined in JSON format. This allows to see in JOSM only the part of the data for the task, instead of having to download the data for the whole city. Code is available here:

  https://github.com/OsmQc/mtl2osm/blob/master/mtl2osm/osm_grid_splitter.py

I hope these tools can be of benefit to the OpenStreetMap community. Do not hesitate to reply if you have any question. I know the documentation on these tools is not 100% complete, so I'll certainly post more details if there is interest in them.

Guillaume


More information about the Imports mailing list