Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenMapTiles implementation: Add missing attributes, use correct classes/subclasses #543

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions resources/process-openmaptiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ poiClasses = { townhall="town_hall", public_building="town_hall", courthous
bag="clothing_store", clothes="clothing_store",
swimming_area="swimming", swimming="swimming",
castle="castle", ruins="castle" }
-- POI classes where class is the matching value and subclass is the value of a separate key
poiSubClasses = { information="information", place_of_worship="religion", pitch="sport" }
poiClassRanks = { hospital=1, railway=2, bus=3, attraction=4, harbor=5, college=6,
school=7, stadium=8, zoo=9, town_hall=10, campsite=11, cemetery=12,
park=13, library=14, police=15, post=16, golf=17, shop=18, grocery=19,
Expand Down Expand Up @@ -582,6 +584,15 @@ function WritePOI(obj,class,subclass,rank)
obj:AttributeNumeric("rank", rank)
obj:Attribute("class", class)
obj:Attribute("subclass", subclass)
-- layer defaults to 0
obj:AttributeNumeric("layer", tonumber(obj:Find("layer")) or 0)
-- indoor defaults to false
obj:AttributeBoolean("indoor", (obj:Find("indoor") == "yes"))
-- level has no default
local level = tonumber(obj:Find("level"))
if level then
obj:AttributeNumeric("level", level)
end
end

-- Set name attributes on any object
Expand Down Expand Up @@ -649,6 +660,11 @@ function GetPOIRank(obj)
v = obj:Find(k) -- k/v are the OSM tag pair
class = poiClasses[v] or k
rank = poiClassRanks[class] or 25
subclassKey = poiSubClasses[v]
if subclassKey then
class = v
v = obj:Find(subclassKey)
end
return rank, class, v
end
end
Expand Down
Loading