This repository was 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 pathwater.lua
55 lines (45 loc) · 1.63 KB
/
water.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
--[[
This file is part of ClearTables
@author Paul Norman <[email protected]>
@copyright 2015-2016 Paul Norman, MIT license
]]--
require "common"
function accept_water_area (tags)
return tags["natural"] == "water" or tags["waterway"] == "riverbank" or tags["landuse"] == "reservoir"
end
function transform_water_area (tags)
local cols = {}
cols.water = tags["water"] or (tags["waterway"] == "riverbank" and "river") or (tags["landuse"] == "reservoir" and "reservoir") or nil
cols.name = tags["name"]
cols.names = names(tags)
return cols
end
function accept_waterway (tags)
return tags["waterway"] == "stream" or tags["waterway"] == "river" or tags["waterway"] == "ditch"
or tags["waterway"] == "canal" or tags["waterway"] == "drain"
end
function transform_waterway (tags)
local cols = {}
cols.name = tags["name"]
cols.names = names(tags)
cols.waterway = tags["waterway"]
cols.bridge = yesno(tags["bridge"])
cols.tunnel = yesno(tags["tunnel"])
cols.layer = layer(tags["layer"])
return cols
end
function water_area_ways (tags, num_keys)
return generic_polygon_way(tags, accept_water_area, transform_water_area)
end
function water_area_rels (tags, num_keys)
if (tags["type"] == "multipolygon" and accept_water_area(tags)) then
return 0, tags
end
return 1, {}
end
function water_area_rel_members (tags, member_tags, member_roles, membercount)
return generic_multipolygon_members(tags, member_tags, membercount, accept_water_area, transform_water_area)
end
function waterway_ways (tags, num_keys)
return generic_line_way(tags, accept_waterway, transform_waterway)
end