Has anyone in here ever worked with OSM data in a spreadsheet?
There are several use cases when loading tag data for specific datasets into a spreadsheet can be very useful. Mainly for POIs and for aligning and fixing tags. Once the tag data is updated in spreadsheet there should be an easy way to load it to OSM. (Assuming you actually know what you are doing!)
After some research, I didn’t find any good solutions for this kind of problem so I decided to write a simple script myself. This script/tool can transform CSV tag data into xml that can be loaded into OSM editor:
Code for this tool is in jsbin and with a browser you can test it here.
Key considerations for designing this:
- CSV file should only include element id and tags. Everything else must be excluded!
- CSV file can contain only limited subset of tags that you want to work with.
- New elements (nodes/ways/relations) cannot be created or deleted - this is only for updating tags for existing elements.
- Empty values for tags are not deleted. If you want to delete a tag, it must be explicitly done by “!delete” to indicate deletion.
Using the tool should be straightforward:
- Check the structure of example CSV data.
- Copy tag data directly from a spreadsheet or export it as CSV and then copy the content of this CSV file.
- OSM xml can be fetched from overpass api or it can be copied manually into the tool.
- Tool compares OSM xml and tag data from csv and generates a new xml based on the changes.
- Save the output to a file.
- Output xml is in JOSM xml flavor - this can be opened with JOSM or Level0 editor.
Example CSV data does the following:
- opening_hours tags are added to 3 nodes
- fountain tag is added to 1 node
- created_by tag is deleted from 1 node
Please treat this tool as untested script!
Any feedback on this tool is welcomed, and discussions on how spreadsheets can be used with OSM data are also encouraged.
WARNING! Using a spreadsheet like Excel, Google sheets or LibreOffice Calc for editing OSM data is generally a bad idea! I can write a long list of things that can can go wrong… Still, experienced spreadsheet users who understand the risks, should be able to choose the tools they what to use.
Mass edits/imports - guidelines and rules for such edits should always be followed, regardless of the tools used.
9 posts - 4 participants
Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/editing-osm-tags-poi-data-in-a-spreadsheet/96843