I've downloaded multiple metro extracts from openstreetmap as PBF files when i try to import them with osm2pgsql it works for the first and creates the tables. I then want to add a column in the planet_osm_ways with a cityID to know which "way id" belonged to which city after i then try to import another city it says 'ERROR: Missing data for column "city_id". is there a way to modify the planet_osm_ways table without breaking the script? I really need to know which id belonged to which metro extract.
Asked
Active
Viewed 618 times
1 Answers
0
You need to edit the style file (default.style
, possibly in osm2pgsql-bin directory) used by osm2pgsql.
You can then add the instruction
#Add custom column
node,way citiid int4 linear
The column will be created, and - provided no tag has this name - will not be populated. You are then free to populate it as you want.

JGH
- 15,928
- 4
- 31
- 48
-
This works great on all the tables expect for the planet_osm_ways table is there a way to get that in there? i use the -s command to generate roads,rels and ways tables. On the roads table it created the column but on the ways it didn't. Is there a way to say on which specific table you want the column generated? – PJ1992 Oct 20 '17 at 17:30