Hello,
I am writing to share some tools that we have developed in preparation for the
City of Montreal open data community-driven import. (Said import is in
preparation and has not yet begun.)
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 <https://github.com/OsmQc/mtl2osm>
See this post for all the details:
http://www.openstreetmap.org/user/Zethradon/diary/28183
<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
<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 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
<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/
<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
<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
_______________________________________________
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk