themepark = nil
end
--- tables required for taginfo
-module.TAGINFO_MAIN = {keys = {}, delete_tags = {}}
-module.TAGINFO_NAME_KEYS = {}
-module.TAGINFO_ADDRESS_KEYS = {}
-
-
-- The single place table.
local place_table_definition = {
name = "place",
end
end
+-- Special transform used with address fallbacks: ignore all names
+-- except for those marked as being part of the address.
+local function address_fallback(place)
+ if next(place.names) == nil or NAMES.house == nil then
+ return place
+ end
+
+ local names = {}
+ for k, v in pairs(place.names) do
+ if NAME_FILTER(k, v) == 'house' then
+ names[k] = v
+ end
+ end
+ return place:clone{names=names}
+end
+
--------- Built-in extratags transformation functions ---------------
local function default_extratags_filter(p, k)
self.has_name = true
elseif atype == 'house' then
self.has_name = true
- fallback = {'place', 'house', PlaceTransform.always}
+ fallback = {'place', 'house', address_fallback}
end
end
end
if self.geometry == nil then
self.geometry = self.geom_func(self.object)
end
- if self.geometry:is_null() then
+ if self.geometry == nil or self.geometry:is_null() then
return 0
end
if geom:is_null() then
geom = o:as_linestring()
+ if geom:is_null() or geom:length() > 30 then
+ return nil
+ end
end
return geom
-- address keys
if o:grab_address_parts{groups=ADDRESS_FILTER} > 0 and fallback == nil then
- fallback = {'place', 'house', PlaceTransform.always}
+ fallback = {'place', 'house', address_fallback}
end
if o.address.country ~= nil and #o.address.country ~= 2 then
o.address['country'] = nil
end
end
+
+function module.get_taginfo()
+ return {main = MAIN_KEYS, name = NAMES, address = ADDRESS_TAGS}
+end
+
return module