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 = {'fallback',
193 information = {include_when_tag_present('tourism', 'information'),
195 route_marker = 'never',
196 trail_blaze = 'never'},
197 junction = {'fallback',
200 nature_reserve = 'fallback',
201 swimming_pool = 'named',
203 lock = {yes = lock_transform},
204 man_made = {pier = 'always',
208 water_tower = 'always',
211 lighthouse = 'always',
212 watermill = 'always',
214 military = {'always',
225 level_crossing = group,
228 buffer_stop = group},
232 attraction = 'fallback',
235 information = exclude_when_key_present('information')},
236 tunnel = {'named_with_key',
240 module.MAIN_TAGS_STREETS = {}
242 module.MAIN_TAGS_STREETS.default = {
243 place = {square = 'always'},
244 highway = {motorway = 'always',
247 secondary = 'always',
249 unclassified = 'always',
250 residential = 'always',
252 living_street = 'always',
253 pedestrian = 'always',
257 footway = filter_footways,
261 motorway_link = 'named',
262 trunk_link = 'named',
263 primary_link = 'named',
264 secondary_link = 'named',
265 tertiary_link = 'named'}
268 module.MAIN_TAGS_STREETS.car = {
269 place = {square = 'always'},
270 highway = {motorway = 'always',
273 secondary = 'always',
275 unclassified = 'always',
276 residential = 'always',
278 living_street = 'always',
281 motorway_link = 'always',
282 trunk_link = 'always',
283 primary_link = 'always',
284 secondary_link = 'always',
285 tertiary_link = 'always'}
288 module.MAIN_TAGS_STREETS.all = {
289 place = {square = 'always'},
290 highway = {motorway = 'always',
293 secondary = 'always',
295 unclassified = 'always',
296 residential = 'always',
298 living_street = 'always',
299 pedestrian = 'always',
305 bridleway = 'always',
307 motorway_link = 'always',
308 trunk_link = 'always',
309 primary_link = 'always',
310 secondary_link = 'always',
311 tertiary_link = 'always'}
317 module.NAME_TAGS = {}
319 module.NAME_TAGS.core = {main = {'name', 'name:*',
320 'int_name', 'int_name:*',
321 'nat_name', 'nat_name:*',
322 'reg_name', 'reg_name:*',
323 'loc_name', 'loc_name:*',
324 'old_name', 'old_name:*',
325 'alt_name', 'alt_name:*', 'alt_name_*',
326 'official_name', 'official_name:*',
327 'place_name', 'place_name:*',
328 'short_name', 'short_name:*'},
329 extra = {'ref', 'int_ref', 'nat_ref', 'reg_ref',
330 'loc_ref', 'old_ref', 'ISO3166-2'}
332 module.NAME_TAGS.address = {house = {'addr:housename'}}
333 module.NAME_TAGS.poi = group_merge({main = {'brand'},
334 extra = {'iata', 'icao'}},
335 module.NAME_TAGS.core)
339 module.ADDRESS_TAGS = {}
341 module.ADDRESS_TAGS.core = { extra = {'addr:*', 'is_in:*', 'tiger:county'},
342 postcode = {'postal_code', 'postcode', 'addr:postcode',
343 'tiger:zip_left', 'tiger:zip_right'},
344 country = {'country_code', 'ISO3166-1',
345 'addr:country_code', 'is_in:country_code',
346 'addr:country', 'is_in:country'}
349 module.ADDRESS_TAGS.houses = { main = {'addr:housenumber',
350 'addr:conscriptionnumber',
351 'addr:streetnumber'},
352 interpolation = {'addr:interpolation'}
355 -- Ignored tags (prefiltered away)
357 module.IGNORE_KEYS = {}
359 module.IGNORE_KEYS.metatags = {'note', 'note:*', 'source', 'source:*', '*source',
360 'attribution', 'comment', 'fixme', 'created_by',
361 'tiger:cfcc', 'tiger:reviewed', 'nysgissam:*',
362 'NHD:*', 'nhd:*', 'gnis:*', 'geobase:*', 'yh:*',
363 'osak:*', 'naptan:*', 'CLC:*', 'import', 'it:fvg:*',
364 'lacounty:*', 'ref:linz:*',
365 'ref:bygningsnr', 'ref:ruian:*', 'building:ruian:type',
368 module.IGNORE_KEYS.name = {'*:prefix', '*:suffix', 'name:prefix:*', 'name:suffix:*',
369 'name:etymology', 'name:etymology:*',
370 'name:signed', 'name:botanical'}
371 module.IGNORE_KEYS.address = {'addr:street:*', 'addr:city:*', 'addr:district:*',
372 'addr:province:*', 'addr:subdistrict:*', 'addr:place:*',
375 -- Extra tags (prefiltered away)
377 module.EXTRATAGS = {}
379 module.EXTRATAGS.required = {'wikipedia', 'wikipedia:*', 'wikidata', 'capital'}