@@ -15,7 +15,7 @@ tables.highways = osm2pgsql.define_way_table('highways', {
1515 { column = ' tags' , type = ' jsonb' },
1616 { column = ' rel_refs' , type = ' text' }, -- for the refs from the relations
1717 { column = ' rel_ids' , sql_type = ' int8[]' }, -- array with integers (for relation IDs)
18- { column = ' geom' , type = ' linestring' },
18+ { column = ' geom' , type = ' linestring' , not_null = true },
1919})
2020
2121-- Tables don't have to have a geometry column
@@ -51,7 +51,8 @@ function osm2pgsql.process_way(object)
5151 -- Data we will store in the "highways" table always has the tags from
5252 -- the way
5353 local row = {
54- tags = object .tags
54+ tags = object .tags ,
55+ geom = object :as_linestring ()
5556 }
5657
5758 -- If there is any data from parent relations, add it in
@@ -69,7 +70,7 @@ function osm2pgsql.process_way(object)
6970 row .rel_ids = ' {' .. table.concat (ids , ' ,' ) .. ' }'
7071 end
7172
72- tables .highways :add_row (row )
73+ tables .highways :insert (row )
7374end
7475
7576-- This function is called for every added, modified, or deleted relation.
8788-- members that might be needed in stage 2.
8889function osm2pgsql .process_relation (object )
8990 if object .tags .type == ' route' and object .tags .route == ' road' and object .tags .ref then
90- tables .routes :add_row ({
91+ tables .routes :insert ({
9192 tags = object .tags
9293 })
9394
0 commit comments