0

I am writing a program that takes in a .osm file and then calculates some new attributes for that feature.

I am using the python libraries gdal and ogr to help deal with the data. So far OGR has proven to be a very useful library for parsing and accessing the OSM file.

I was wondering if it possible to add an additional field to the OSM file using OGR.

There is a .SetField() function, but it only seems to work on fields that already exist. Is there a way I can design my own field and add it as an extra field to the OSM file?

Bonus points if I can keep the original OSM file intact for testing purposes!

Alternatively, it doesn't have to use OGR, any Python library will do.

Skylion
  • 529
  • 1
  • 6
  • 16
  • did you see this post: http://gis.stackexchange.com/questions/7436/how-to-add-attribute-field-to-existing-shapefile-via-python-without-arcgis – kttii Jun 17 '16 at 18:05
  • 2
    The GDAL OSM driver is read only so adding fields and writing them to .osm file is not possible. I believe that it is possible to join external data by common feature ids. – user30184 Jun 17 '16 at 21:07
  • Could you provide a tutorial on how to do that? It would be greatly appreciated. – Skylion Jun 20 '16 at 13:39

0 Answers0