[OSM-talk] New script to do CSV -> OSM

Nick Burch openstreetmap at gagravarr.org
Tue Mar 20 19:07:13 GMT 2007


Hi All

I wanted to import some data, in a csv file, to OSM. Having first checked 
that the licence on my data was compatible, I then needed something to 
convert my data into osm format, check it didn't clash with any existing 
data, then upload it.

Having failed to find a script to do this, I wrote one:
 	http://svn.openstreetmap.org/utils/importers/csv2osm/

You supply the script with a config file, which contains all your 
customisations. The config file specifies who to download/upload as, what 
csv file to use, how far from the new point to search for existing ones, 
what tags to look for to detect potential duplicates, and how to turn a 
line of CSV into the tags for a new node. A couple of examples are in svn.

Having set that up, you run the script. It converts each line at a time, 
downloads the osm data around the new node, and checks for a possible 
clash. If one is found, it writes the node to problem.osm. If not, it 
uploads the new node to the api, and writes it to worked.osm.


Hopefully it'll be of use to other people in the future.

Nick

PS I used the script to do an airports import, with
     source=Gagravarr_Airports, if you spot those about




More information about the talk mailing list