1 -- Defines defaults used in the topic definitions.
7 local function group_merge(group1, group2)
8 for name, values in pairs(group2) do
9 if group1[name] == nil then
12 for _, v in pairs(values) do
13 table.insert(group1[name], v)
21 -- Customized main tag filter functions
23 local EXCLUDED_FOOTWAYS = { sidewalk = 1, crossing = 1, link = 1, traffic_aisle }
25 local function filter_footways(place)
26 if place.has_name then
27 local footway = place.object.tags.footway
28 if footway == nil or EXCLUDED_FOOTWAYS[footway] ~= 1 then
35 local function include_when_tag_present(key, value, named)
37 return function(place)
38 if place.has_name and place.intags[key] == value then
44 return function(place)
45 if place.intags[key] == value then
53 local function exclude_when_key_present(key, named)
55 return function(place)
56 if place.has_name and place.intags[key] == nil then
62 return function(place)
63 if place.intags[key] == nil then
72 local function lock_transform(place)
73 if place.object.tags.waterway ~= nil then
74 local name = place.object.tags.lock_name
76 return place:clone{names={name=name, ref=place.object.tags.lock_ref}}
83 -- Main tag definition
87 module.MAIN_TAGS.admin = {
88 boundary = {administrative = 'named'},
89 landuse = {residential = 'fallback',
91 farmyard = 'fallback',
92 industrial = 'fallback',
93 commercial = 'fallback',
94 allotments = 'fallback',
96 place = {county = 'always',
98 municipality = 'always',
106 subdivision = 'always',
107 allotments = 'always',
108 neighbourhood = 'always',
110 isolated_dwelling = 'always',
112 city_block = 'always',
116 module.MAIN_TAGS.all_boundaries = {
119 land_area = 'delete',
120 postal_code = 'always'},
121 landuse = 'fallback',
125 module.MAIN_TAGS.natural = {
127 riverbank = 'delete'},
131 coastline = 'delete',
133 water = exclude_when_key_present('water', true)},
134 mountain_pass = {'always',
136 water = {include_when_tag_present('natural', 'water', true),
144 intermittent = 'delete',
149 module.MAIN_TAGS_POIS = function (group)
150 group = group or 'delete'
152 aerialway = {'always',
159 parking_space = group,
160 parking_entrance = group,
161 waste_disposal = group,
162 hunting_stand = group},
163 building = {'fallback',
165 bridge = {'named_with_key',
171 emergency = {'always',
174 fire_hydrant = group},
175 healthcare = {'fallback',
180 turning_circle = group,
181 mini_roundabout = group,
186 turning_loop = group,
187 passing_place = group,
188 street_lamp = 'named',
189 traffic_signals = 'named'},
190 historic = {'always',
193 information = {include_when_tag_present('tourism', 'information')},
194 junction = {'fallback',
197 nature_reserve = 'fallback',
198 swimming_pool = 'named',
200 lock = {yes = lock_transform},
201 man_made = {pier = 'always',
205 water_tower = 'always',
208 lighthouse = 'always',
209 watermill = 'always',
211 military = {'always',
222 level_crossing = group,
225 buffer_stop = group},
231 information = 'fallback'},
232 tunnel = {'named_with_key',
236 module.MAIN_TAGS_STREETS = {}
238 module.MAIN_TAGS_STREETS.default = {
239 place = {square = 'always'},
240 highway = {motorway = 'always',
243 secondary = 'always',
245 unclassified = 'always',
246 residential = 'always',
248 living_street = 'always',
249 pedestrian = 'always',
253 footway = filter_footways,
257 motorway_link = 'named',
258 trunk_link = 'named',
259 primary_link = 'named',
260 secondary_link = 'named',
261 tertiary_link = 'named'}
264 module.MAIN_TAGS_STREETS.car = {
265 place = {square = 'always'},
266 highway = {motorway = 'always',
269 secondary = 'always',
271 unclassified = 'always',
272 residential = 'always',
274 living_street = 'always',
277 motorway_link = 'always',
278 trunk_link = 'always',
279 primary_link = 'always',
280 secondary_link = 'always',
281 tertiary_link = 'always'}
284 module.MAIN_TAGS_STREETS.all = {
285 place = {square = 'always'},
286 highway = {motorway = 'always',
289 secondary = 'always',
291 unclassified = 'always',
292 residential = 'always',
294 living_street = 'always',
295 pedestrian = 'always',
301 bridleway = 'always',
303 motorway_link = 'always',
304 trunk_link = 'always',
305 primary_link = 'always',
306 secondary_link = 'always',
307 tertiary_link = 'always'}
313 module.NAME_TAGS = {}
315 module.NAME_TAGS.core = {main = {'name', 'name:*',
316 'int_name', 'int_name:*',
317 'nat_name', 'nat_name:*',
318 'reg_name', 'reg_name:*',
319 'loc_name', 'loc_name:*',
320 'old_name', 'old_name:*',
321 'alt_name', 'alt_name:*', 'alt_name_*',
322 'official_name', 'official_name:*',
323 'place_name', 'place_name:*',
324 'short_name', 'short_name:*'},
325 extra = {'ref', 'int_ref', 'nat_ref', 'reg_ref',
326 'loc_ref', 'old_ref', 'ISO3166-2'}
328 module.NAME_TAGS.address = {house = {'addr:housename'}}
329 module.NAME_TAGS.poi = group_merge({main = {'brand'},
330 extra = {'iata', 'icao'}},
331 module.NAME_TAGS.core)
335 module.ADDRESS_TAGS = {}
337 module.ADDRESS_TAGS.core = { extra = {'addr:*', 'is_in:*', 'tiger:county'},
338 postcode = {'postal_code', 'postcode', 'addr:postcode',
339 'tiger:zip_left', 'tiger:zip_right'},
340 country = {'country_code', 'ISO3166-1',
341 'addr:country_code', 'is_in:country_code',
342 'addr:country', 'is_in:country'}
345 module.ADDRESS_TAGS.houses = { main = {'addr:housenumber',
346 'addr:conscriptionnumber',
347 'addr:streetnumber'},
348 interpolation = {'addr:interpolation'}
351 -- Ignored tags (prefiltered away)
353 module.IGNORE_KEYS = {}
355 module.IGNORE_KEYS.metatags = {'note', 'note:*', 'source', 'source:*', '*source',
356 'attribution', 'comment', 'fixme', 'created_by',
357 'tiger:cfcc', 'tiger:reviewed', 'nysgissam:*',
358 'NHD:*', 'nhd:*', 'gnis:*', 'geobase:*', 'yh:*',
359 'osak:*', 'naptan:*', 'CLC:*', 'import', 'it:fvg:*',
360 'lacounty:*', 'ref:linz:*',
361 'ref:bygningsnr', 'ref:ruian:*', 'building:ruian:type',
364 module.IGNORE_KEYS.name = {'*:prefix', '*:suffix', 'name:prefix:*', 'name:suffix:*',
365 'name:etymology', 'name:etymology:*',
366 'name:signed', 'name:botanical'}
367 module.IGNORE_KEYS.address = {'addr:street:*', 'addr:city:*', 'addr:district:*',
368 'addr:province:*', 'addr:subdistrict:*', 'addr:place:*',
371 -- Extra tags (prefiltered away)
373 module.EXTRATAGS = {}
375 module.EXTRATAGS.required = {'wikipedia', 'wikipedia:*', 'wikidata', 'capital'}