Skip to main content
Question

OSM to PostGIS keeping all tags

  • January 28, 2019
  • 1 reply
  • 10 views

btl
Contributor
Forum|alt.badge.img+3
  • Contributor

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.

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

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings