Skip to main content

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.

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