-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhab_aeroway.lua
executable file
·96 lines (80 loc) · 1.74 KB
/
hab_aeroway.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
-- https://taginfo.openstreetmap.org/keys
node_keys = {
-- "Aerialway",
-- "Aeroway",
-- "Amenity",
-- "Barrier",
-- "Boundary",
-- "building",
-- "Craft",
-- "Emergency",
-- "Geological",
-- "Highway",
-- "Historic",
-- "Common Landuse Key Values",
-- "Other Landuse Key Values",
-- "Leisure",
-- "Man_made",
-- "Military",
-- "natural",
-- "Office",
-- "place",
-- "Power",
-- "Public Transport",
-- "Railway",
-- "Route",
-- "Shop",
-- "Sport",
-- "Telecom",
-- "Tourism",
-- "Waterway"
}
G_DEFAULT = 0
G_COUNTS = {}
function init_function()
end
local function is_in (val, tab)
for index, value in ipairs(tab) do
if value == val then
return true
end
end
return false
end
function exit_function()
for _k,_v in pairs(G_COUNTS)
do
print("\n")
print(_k)
for k,v in pairs(_v)
do
print("\t", k, v)
end
end
end
function node_function(node)
end
function way_function(way)
local layer = nil
local name = way:Find("name");
-- aeroway
local aeroway = way:Find("aeroway")
if aeroway ~= nil and aeroway ~= "" then
local class = aeroway
if G_COUNTS["aeroway"] == nil then G_COUNTS["aeroway"] = {} end
if G_COUNTS["aeroway"][class] == nil then G_COUNTS["aeroway"][class] = 0 end
if is_in( class, { "aerodrome", "apron"} )then
layer = "aeroway"
way:Layer(layer, true)
way:Attribute("class", class)
if name ~= nil and name ~= "" then way:Attribute("name",name) end
G_COUNTS["aeroway"][class] = G_COUNTS["aeroway"][class] + 1
else
layer = "aeroway_other"
way:Layer(layer, true)
way:Attribute("class", class)
if name ~= nil and name ~= "" then way:Attribute("name",name) end
G_COUNTS["aeroway"][class] = G_COUNTS["aeroway"][class] + 1
end
end
end