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',
199 landuse = {cemetery = 'always'},
201 nature_reserve = 'fallback',
202 swimming_pool = 'named',
204 lock = {yes = lock_transform},
205 man_made = {pier = 'always',
209 water_tower = 'always',
212 lighthouse = 'always',
213 watermill = 'always',
215 military = {'always',
226 level_crossing = group,
229 buffer_stop = group},
233 attraction = 'fallback',
236 information = exclude_when_key_present('information')},
237 tunnel = {'named_with_key',
241 module.MAIN_TAGS_STREETS = {}
243 module.MAIN_TAGS_STREETS.default = {
244 place = {square = 'always'},
245 highway = {motorway = 'always',
248 secondary = 'always',
250 unclassified = 'always',
251 residential = 'always',
253 living_street = 'always',
254 pedestrian = 'always',
258 footway = filter_footways,
262 motorway_link = 'named',
263 trunk_link = 'named',
264 primary_link = 'named',
265 secondary_link = 'named',
266 tertiary_link = 'named'}
269 module.MAIN_TAGS_STREETS.car = {
270 place = {square = 'always'},
271 highway = {motorway = 'always',
274 secondary = 'always',
276 unclassified = 'always',
277 residential = 'always',
279 living_street = 'always',
282 motorway_link = 'always',
283 trunk_link = 'always',
284 primary_link = 'always',
285 secondary_link = 'always',
286 tertiary_link = 'always'}
289 module.MAIN_TAGS_STREETS.all = {
290 place = {square = 'always'},
291 highway = {motorway = 'always',
294 secondary = 'always',
296 unclassified = 'always',
297 residential = 'always',
299 living_street = 'always',
300 pedestrian = 'always',
306 bridleway = 'always',
308 motorway_link = 'always',
309 trunk_link = 'always',
310 primary_link = 'always',
311 secondary_link = 'always',
312 tertiary_link = 'always'}
318 module.NAME_TAGS = {}
320 module.NAME_TAGS.core = {main = {'name', 'name:*',
321 'int_name', 'int_name:*',
322 'nat_name', 'nat_name:*',
323 'reg_name', 'reg_name:*',
324 'loc_name', 'loc_name:*',
325 'old_name', 'old_name:*',
326 'alt_name', 'alt_name:*', 'alt_name_*',
327 'official_name', 'official_name:*',
328 'place_name', 'place_name:*',
329 'short_name', 'short_name:*'},
330 extra = {'ref', 'int_ref', 'nat_ref', 'reg_ref',
331 'loc_ref', 'old_ref', 'ISO3166-2'}
333 module.NAME_TAGS.address = {house = {'addr:housename'}}
334 module.NAME_TAGS.poi = group_merge({main = {'brand'},
335 extra = {'iata', 'icao', 'faa'}},
336 module.NAME_TAGS.core)
340 module.ADDRESS_TAGS = {}
342 module.ADDRESS_TAGS.core = { extra = {'addr:*', 'is_in:*', 'tiger:county'},
343 postcode = {'postal_code', 'postcode', 'addr:postcode',
344 'tiger:zip_left', 'tiger:zip_right'},
345 country = {'country_code', 'ISO3166-1',
346 'addr:country_code', 'is_in:country_code',
347 'addr:country', 'is_in:country'}
350 module.ADDRESS_TAGS.houses = { main = {'addr:housenumber',
351 'addr:conscriptionnumber',
352 'addr:streetnumber'},
353 interpolation = {'addr:interpolation'}
356 -- Ignored tags (prefiltered away)
358 module.IGNORE_KEYS = {}
360 module.IGNORE_KEYS.metatags = {'note', 'note:*', 'source', 'source:*', '*source',
361 'attribution', 'comment', 'fixme', 'created_by',
362 'tiger:cfcc', 'tiger:reviewed', 'nysgissam:*',
363 'NHD:*', 'nhd:*', 'gnis:*', 'geobase:*', 'yh:*',
364 'osak:*', 'naptan:*', 'CLC:*', 'import', 'it:fvg:*',
365 'lacounty:*', 'ref:linz:*',
366 'ref:bygningsnr', 'ref:ruian:*', 'building:ruian:type',
369 module.IGNORE_KEYS.name = {'*:prefix', '*:suffix', 'name:prefix:*', 'name:suffix:*',
370 'name:etymology', 'name:etymology:*',
371 'name:signed', 'name:botanical'}
372 module.IGNORE_KEYS.address = {'addr:street:*', 'addr:city:*', 'addr:district:*',
373 'addr:province:*', 'addr:subdistrict:*', 'addr:place:*',
376 -- Extra tags (prefiltered away)
378 module.EXTRATAGS = {}
380 module.EXTRATAGS.required = {'wikipedia', 'wikipedia:*', 'wikidata', 'capital'}