return count
end
+function Place:grab_name_parts(data)
+ local fallback = nil
+
+ if data.groups ~= nil then
+ for k, v in pairs(self.object.tags) do
+ local atype = data.groups(k, v)
+
+ if atype ~= nil then
+ self.names[k] = v
+ if atype == 'main' then
+ self.has_name = true
+ elseif atype == 'house' then
+ self.has_name = true
+ fallback = {'place', 'house', 'always'}
+ end
+ end
+ end
+ end
+
+ return fallback
+end
+
function Place:grab_tag(key)
return self.object:grab_tag(key)
end
end
function process_tags(o)
- local fallback
-
o:delete{match = PRE_DELETE}
o:grab_extratags{match = PRE_EXTRAS}
end}
end
+ -- name keys
+ local fallback = o:grab_name_parts{groups=NAMES}
+
-- address keys
- if o:grab_name{match=HOUSENAME_TAGS} > 0 then
- fallback = {'place', 'house', 'always'}
- end
if o:grab_address_parts{groups=ADDRESS_TAGS} > 0 and fallback == nil then
fallback = {'place', 'house', 'always'}
end
return
end
- -- name keys
- o:grab_name{match = NAMES}
- o:grab_name{match = REFS, include_on_name = false}
-
o:delete{match = POST_DELETE}
o:grab_extratags{match = POST_EXTRAS}
'addr:street:name', 'addr:street:type'}
}
-
-NAMES = tag_match{keys = {'name', 'name:*',
+NAMES = key_group{main = {'name', 'name:*',
'int_name', 'int_name:*',
'nat_name', 'nat_name:*',
'reg_name', 'reg_name:*',
'alt_name', 'alt_name:*', 'alt_name_*',
'official_name', 'official_name:*',
'place_name', 'place_name:*',
- 'short_name', 'short_name:*', 'brand'}}
-
-REFS = tag_match{keys = {'ref', 'int_ref', 'nat_ref', 'reg_ref', 'loc_ref', 'old_ref',
- 'iata', 'icao', 'pcode', 'pcode:*', 'ISO3166-2'}}
-
-HOUSENAME_TAGS = tag_match{keys = {'addr:housename'}}
+ 'short_name', 'short_name:*', 'brand'},
+ extra = {'ref', 'int_ref', 'nat_ref', 'reg_ref',
+ 'loc_ref', 'old_ref',
+ 'iata', 'icao', 'pcode', 'pcode:*', 'ISO3166-2'},
+ house = {'addr:housename'}
+ }
ADDRESS_TAGS = key_group{main = {'addr:housenumber',
'addr:conscriptionnumber',