Skip to main content
Question

OSM to PostGIS keeping all tags

  • January 28, 2019
  • 1 reply
  • 27 views

btl
Contributor
Forum|alt.badge.img+8

Is there a way process OSM data so that I organise the most important tags into separate attributes while keeping all other key/value pairs e.g. by dumping them into another attribute called "othertags"?

For example; an entry in my Highway table might look like this:

highway

 

trunk

 

lanes

 

2

 

oneway

 

yes

 

width

 

12

 

othertags

 

"surface"=>"asphalt", "name"=>"Ermine Street", "maxspeed"=>"70", "lit"=>"no", "ref"=>"A1", "name:en"=>"Ermine Street", "maxwieght"=>".....

 

 

Basically I don't want to lose any info, but I don't want to expose all tags to potentially several tens of mostly useless attributes.
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

david_r
Celebrity
  • January 28, 2019

I think the most sensible solution would be to store the "othertags" in a separate table as key/value pairs and with a foreign key pointing back to the main table entry.

You could use a StringSearcher or a small Python script to split up the "othertags" to key value pairs. If your data doesn't have a unique global ID, you can create on using the Counter.

The othertags table could e.g. look like this:

osm_idkeyvalue1surfaceasphalt1nameErmine Street1maxspeed70