This repository has been archived by the owner on Apr 15, 2018. It is now read-only.
forked from ClearTables/ClearTables
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilding.lua
43 lines (36 loc) · 1.5 KB
/
building.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
--[[
This file is part of ClearTables
@author Paul Norman <[email protected]>
@copyright 2015-2016 Paul Norman, MIT license
]]--
require "common"
function accept_building (tags)
return (tags["building"] or tags["railway"] == "station" or tags["aeroway"] == "terminal") and tags["building"] ~= "no"
end
function transform_building (tags)
local cols = {}
-- Prefer the information that it's a railway station or aeroway terminal to the building tag
-- from accept_building we know railway=station or aeroway=terminal or non-no building
cols.building = tags["railway"] == "station" and "railway_station" or
tags["aeroway"] == "terminal" and "aeroway_terminal" or
tags["building"]
cols.name = tags["name"]
cols.names = names(tags)
if tags["building:levels"] and string.find(tags["building:levels"], "^%d+$") and tonumber(tags["building:levels"]) < 10000 then
cols.levels = tostring(tonumber(tags["building:levels"]))
end
cols.height = height(tags["height"])
return cols
end
function building_ways (tags, num_keys)
return generic_polygon_way(tags, accept_building, transform_building)
end
function building_rels (tags, num_keys)
if (tags["type"] == "multipolygon" and accept_building(tags)) then
return 0, tags
end
return 1, {}
end
function building_rel_members (tags, member_tags, member_roles, membercount)
return generic_multipolygon_members(tags, member_tags, membercount, accept_building, transform_building)
end