@@ -4,7 +4,6 @@ local test_table = osm2pgsql.define_table{
44 ids = { type = ' any' , type_column = ' osm_type' , id_column = ' osm_id' },
55 columns = {
66 { column = ' tags' , type = ' hstore' },
7- { column = ' name' , type = ' text' },
87 { column = ' geom' , type = ' geometry' },
98 }
109}
@@ -13,103 +12,42 @@ function is_empty(some_table)
1312 return next (some_table ) == nil
1413end
1514
16- function clean_tags (tags )
17- tags .odbl = nil
18- tags .created_by = nil
19- tags .source = nil
20- tags [' source:ref' ] = nil
21- tags [' source:name' ] = nil
22- end
23-
24- function is_polygon (tags )
25- if tags .aeroway
26- or tags .amenity
27- or tags .area
28- or tags .building
29- or tags .harbour
30- or tags .historic
31- or tags .landuse
32- or tags .leisure
33- or tags .man_made
34- or tags .military
35- or tags .natural
36- or tags .office
37- or tags .place
38- or tags .power
39- or tags .public_transport
40- or tags .shop
41- or tags .sport
42- or tags .tourism
43- or tags .water
44- or tags .waterway
45- or tags .wetland
46- or tags [' abandoned:aeroway' ]
47- or tags [' abandoned:amenity' ]
48- or tags [' abandoned:building' ]
49- or tags [' abandoned:landuse' ]
50- or tags [' abandoned:power' ]
51- or tags [' area:highway' ]
52- then
53- return true
54- else
55- return false
56- end
57- end
58-
59- function osm2pgsql .process_node (data )
60- clean_tags (data .tags )
61- if is_empty (data .tags ) then
15+ function osm2pgsql .process_node (object )
16+ if is_empty (object .tags ) then
6217 return
6318 end
6419
6520 test_table :add_row ({
66- tags = data .tags ,
21+ tags = object .tags ,
6722 geom = { create = ' point' }
6823 })
6924end
7025
71- function osm2pgsql .process_way (data )
72- clean_tags (data .tags )
73- if is_empty (data .tags ) then
26+ function osm2pgsql .process_way (object )
27+ if is_empty (object .tags ) then
7428 return
7529 end
7630
77- if is_polygon ( data .tags ) then
31+ if object .tags . building then
7832 test_table :add_row ({
79- tags = data .tags ,
80- name = data .tags .name ,
33+ tags = object .tags ,
8134 geom = { create = ' area' }
8235 })
8336 else
8437 test_table :add_row ({
85- tags = data .tags ,
86- name = data .tags .name ,
38+ tags = object .tags ,
8739 geom = { create = ' line' }
8840 })
8941 end
9042end
9143
92- function osm2pgsql .process_relation (data )
93- clean_tags (data .tags )
94- if is_empty (data .tags ) then
95- return
96- end
97-
98- if data .tags .type == ' multipolygon' or data .tags .type == ' boundary' then
44+ function osm2pgsql .process_relation (object )
45+ if object .tags .type == ' multipolygon' then
9946 test_table :add_row ({
100- tags = data .tags ,
101- name = data .tags .name ,
47+ tags = object .tags ,
10248 geom = { create = ' area' , multi = false }
10349 })
10450 return
10551 end
106-
107- if data .tags .type == ' route' then
108- test_table :add_row ({
109- tags = data .tags ,
110- name = data .tags .name ,
111- geom = { create = ' line' }
112- })
113- end
11452end
11553
0 commit comments