forked from systemed/tilemaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess.lua
46 lines (38 loc) · 1.04 KB
/
process.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
-- Nodes will only be processed if one of these keys is present
node_keys = { "amenity", "shop" }
-- Initialize Lua logic
function init_function()
end
-- Finalize Lua logic()
function exit_function()
end
-- Assign nodes to a layer, and set attributes, based on OSM tags
function node_function(node)
local amenity = node:Find("amenity")
local shop = node:Find("shop")
if amenity~="" or shop~="" then
node:Layer("poi", false)
if amenity~="" then node:Attribute("class",amenity)
else node:Attribute("class",shop) end
node:Attribute("name", node:Find("name"))
end
end
-- Similarly for ways
function way_function(way)
local highway = way:Find("highway")
local waterway = way:Find("waterway")
local building = way:Find("building")
if highway~="" then
way:Layer("transportation", false)
way:Attribute("class", highway)
-- way:Attribute("id",way:Id())
-- way:AttributeNumeric("area",37)
end
if waterway~="" then
way:Layer("waterway", false)
way:Attribute("class", waterway)
end
if building~="" then
way:Layer("building", true)
end
end