Why not ask your question on the new OpenStreetMap Community Forum?



I want to load OSM data into QGIS with the OSMPlugin. It works fine, the only problem is that all the tags are saved in one column. Is there a way to seperate each tag into one column besides the defautl ones (name, place, highway, etc.)?



asked 01 Nov '12, 09:30

Wasus's gravatar image

accept rate: 0%

One possible solution is to save the osm file to a shapefile, open it in ArcGIS, and seperate the one column into several columns with the following python field calculator code:

def parseAddr(textRaw, addrTag):
  #addrTag = 'addr:city'
  text = textRaw.replace('"','')
  lstTags = text.split(',')
  for i in range(0, len(lstTags)):
    lstSingleTag = lstTags[i].split('=')
    if addrTag == lstSingleTag[0]:
      tag = lstSingleTag[lstSingleTag.index(addrTag)+1]
      return tag

Then expression for city field would be: City = parseAddr('!FieldName!', 'addr:city')

For streets field: Street = parseAddr('!FieldName!', 'addr:street')

permanent link

answered 05 Dec '12, 12:55

Wasus's gravatar image

accept rate: 0%

edited 05 Dec '12, 12:56

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 01 Nov '12, 09:30

question was seen: 3,184 times

last updated: 05 Dec '12, 12:56

powered by OSQA