@@ -36,18 +36,6 @@ tables.route = osm2pgsql.define_table{
3636 }
3737}
3838
39- function is_empty (some_table )
40- return next (some_table ) == nil
41- end
42-
43- function clean_tags (tags )
44- tags .odbl = nil
45- tags .created_by = nil
46- tags .source = nil
47- tags [' source:ref' ] = nil
48- tags [' source:name' ] = nil
49- end
50-
5139function is_polygon (tags )
5240 if tags .aeroway
5341 or tags .amenity
@@ -83,55 +71,60 @@ function is_polygon(tags)
8371 end
8472end
8573
86- function osm2pgsql .process_node (data )
87- clean_tags (data .tags )
88- if is_empty (data .tags ) then
74+ local delete_keys = {
75+ ' odbl' ,
76+ ' created_by' ,
77+ ' source'
78+ }
79+
80+ local clean_tags = osm2pgsql .make_clean_tags_func (delete_keys )
81+
82+ function osm2pgsql .process_node (object )
83+ if clean_tags (object .tags ) then
8984 return
9085 end
9186
9287 tables .point :add_row ({
93- tags = data .tags
88+ tags = object .tags
9489 })
9590end
9691
97- function osm2pgsql .process_way (data )
98- clean_tags (data .tags )
99- if is_empty (data .tags ) then
92+ function osm2pgsql .process_way (object )
93+ if clean_tags (object .tags ) then
10094 return
10195 end
10296
103- if is_polygon (data .tags ) then
97+ if is_polygon (object .tags ) then
10498 tables .polygon :add_row ({
105- tags = data .tags ,
106- name = data .tags .name ,
99+ tags = object .tags ,
100+ name = object .tags .name ,
107101 geom = { create = ' area' }
108102 })
109103 else
110104 tables .line :add_row ({
111- tags = data .tags ,
112- name = data .tags .name
105+ tags = object .tags ,
106+ name = object .tags .name
113107 })
114108 end
115109end
116110
117- function osm2pgsql .process_relation (data )
118- clean_tags (data .tags )
119- if is_empty (data .tags ) then
111+ function osm2pgsql .process_relation (object )
112+ if clean_tags (object .tags ) then
120113 return
121114 end
122115
123- if data .tags .type == ' multipolygon' or data .tags .type == ' boundary' then
116+ if object .tags .type == ' multipolygon' or object .tags .type == ' boundary' then
124117 tables .polygon :add_row ({
125- tags = data .tags ,
126- name = data .tags .name ,
118+ tags = object .tags ,
119+ name = object .tags .name ,
127120 geom = { create = ' area' , multi = false }
128121 })
129122 return
130123 end
131124
132- if data .tags .type == ' route' then
125+ if object .tags .type == ' route' then
133126 tables .route :add_row ({
134- tags = data .tags ,
127+ tags = object .tags ,
135128 geom = { create = ' line' }
136129 })
137130 end
0 commit comments