]> git.openstreetmap.org Git - nominatim.git/blob - lib-lua/themes/nominatim/presets.lua
exclude unnamed swimming pools
[nominatim.git] / lib-lua / themes / nominatim / presets.lua
1 -- Defines defaults used in the topic definitions.
2
3 local module = {}
4
5 -- Customized main tag filter functions
6
7 local EXCLUDED_FOOTWAYS = { sidewalk = 1, crossing = 1, link = 1, traffic_aisle }
8
9 local function filter_footways(place)
10     if place.has_name then
11         local footway = place.object.tags.footway
12         if footway == nil or EXCLUDED_FOOTWAYS[footway] ~= 1 then
13             return place
14         end
15     end
16     return false
17 end
18
19 local function include_when_tag_present(key, value, named)
20     if named then
21         return function(place)
22                    if place.has_name and place.intags[key] == value then
23                        return place
24                    end
25                    return false
26                end
27     else
28         return function(place)
29                    if place.intags[key] == value then
30                        return place
31                    end
32                    return false
33                end
34     end
35 end
36
37 local function exclude_when_key_present(key, named)
38     if named then
39         return function(place)
40                    if place.has_name and place.intags[key] == nil then
41                        return place
42                    end
43                    return false
44                end
45     else
46         return function(place)
47                    if place.intags[key] == nil then
48                        return place
49                    end
50                    return false
51                end
52
53     end
54 end
55
56 local function lock_transform(place)
57     if place.object.tags.waterway ~= nil then
58         local name = place.object.tags.lock_name
59         if name ~= nil then
60             return place:clone{names={name=name, ref=place.object.tags.lock_ref}}
61         end
62     end
63
64     return false
65 end
66
67 -- Main tag definition
68
69 module.MAIN_TAGS = {}
70
71 module.MAIN_TAGS.admin = {
72     boundary = {administrative = 'named'},
73     landuse = {residential = 'fallback',
74                farm = 'fallback',
75                farmyard = 'fallback',
76                industrial = 'fallback',
77                commercial = 'fallback',
78                allotments = 'fallback',
79                retail = 'fallback'},
80     place = {county = 'always',
81              district = 'always',
82              municipality = 'always',
83              city = 'always',
84              town = 'always',
85              borough = 'always',
86              village = 'always',
87              suburb = 'always',
88              hamlet = 'always',
89              croft = 'always',
90              subdivision = 'always',
91              allotments = 'always',
92              neighbourhood = 'always',
93              quarter = 'always',
94              isolated_dwelling = 'always',
95              farm = 'always',
96              city_block = 'always',
97              locality = 'always'}
98 }
99
100 module.MAIN_TAGS.all_boundaries = {
101     boundary = {'named',
102                 place = 'delete',
103                 land_area = 'delete',
104                 postal_code = 'always'},
105     landuse = 'fallback',
106     place = 'always'
107 }
108
109 module.MAIN_TAGS.natural = {
110     waterway = {'named',
111                 riverbank = 'delete'},
112     natural = {'named',
113                yes = 'delete',
114                no = 'delete',
115                coastline = 'delete',
116                saddle = 'fallback',
117                water = exclude_when_key_present('water', true)},
118     mountain_pass = {'always',
119                      no = 'delete'},
120     water = {include_when_tag_present('natural', 'water', true),
121              river = 'never',
122              stream = 'never',
123              canal = 'never',
124              ditch = 'never',
125              drain = 'never',
126              fish_pass = 'never',
127              yes = 'delete',
128              intermittent = 'delete',
129              tidal = 'delete'
130              }
131 }
132
133 module.MAIN_TAGS_POIS = function (group)
134     group = group or 'delete'
135     return {
136     aerialway = {'always',
137                  no = group,
138                  pylon = group},
139     aeroway = {'always',
140                no = group},
141     amenity = {'always',
142                no = group,
143                parking_space = group,
144                parking_entrance = group,
145                waste_disposal = group,
146                hunting_stand = group},
147     building = {'fallback',
148                 no = group},
149     bridge = {'named_with_key',
150               no = group},
151     club = {'always',
152             no = group},
153     craft = {'always',
154              no = group},
155     emergency = {'always',
156                  no = group,
157                  yes = group,
158                  fire_hydrant = group},
159     healthcare = {'fallback',
160                   yes = group,
161                   no = group},
162     highway = {'always',
163                no = group,
164                turning_circle = group,
165                mini_roundabout = group,
166                noexit = group,
167                crossing = group,
168                give_way = group,
169                stop = group,
170                turning_loop = group,
171                passing_place = group,
172                street_lamp = 'named',
173                traffic_signals = 'named'},
174     historic = {'always',
175                 yes = group,
176                 no = group},
177     information = {include_when_tag_present('tourism', 'information')},
178     junction = {'fallback',
179                 no = group},
180     leisure = {'always',
181                nature_reserve = 'fallback',
182                swimming_pool = 'named',
183                no = group},
184     lock = {yes = lock_transform},
185     man_made = {pier = 'always',
186                 tower = 'always',
187                 bridge = 'always',
188                 works = 'named',
189                 water_tower = 'always',
190                 dyke = 'named',
191                 adit = 'named',
192                 lighthouse = 'always',
193                 watermill = 'always',
194                 tunnel = 'always'},
195     military = {'always',
196                 yes = group,
197                 no = group},
198     office = {'always',
199               no = group},
200     railway = {'named',
201                rail = group,
202                no = group,
203                abandoned = group,
204                disused = group,
205                razed = group,
206                level_crossing = group,
207                switch = group,
208                signal = group,
209                buffer_stop = group},
210     shop = {'always',
211             no = group},
212     tourism = {'always',
213                no = group,
214                yes = group,
215                information = 'fallback'},
216     tunnel = {'named_with_key',
217               no = group}
218 } end
219
220 module.MAIN_TAGS_STREETS = {}
221
222 module.MAIN_TAGS_STREETS.default = {
223     place = {square = 'always'},
224     highway = {motorway = 'always',
225                trunk = 'always',
226                primary = 'always',
227                secondary = 'always',
228                tertiary = 'always',
229                unclassified = 'always',
230                residential = 'always',
231                road = 'always',
232                living_street = 'always',
233                pedestrian = 'always',
234                service = 'named',
235                cycleway = 'named',
236                path = 'named',
237                footway = filter_footways,
238                steps = 'named',
239                bridleway = 'named',
240                track = 'named',
241                motorway_link = 'named',
242                trunk_link = 'named',
243                primary_link = 'named',
244                secondary_link = 'named',
245                tertiary_link = 'named'}
246 }
247
248 module.MAIN_TAGS_STREETS.car = {
249     place = {square = 'always'},
250     highway = {motorway = 'always',
251                trunk = 'always',
252                primary = 'always',
253                secondary = 'always',
254                tertiary = 'always',
255                unclassified = 'always',
256                residential = 'always',
257                road = 'always',
258                living_street = 'always',
259                service = 'always',
260                track = 'always',
261                motorway_link = 'always',
262                trunk_link = 'always',
263                primary_link = 'always',
264                secondary_link = 'always',
265                tertiary_link = 'always'}
266 }
267
268 module.MAIN_TAGS_STREETS.all = {
269     place = {square = 'always'},
270     highway = {motorway = 'always',
271                trunk = 'always',
272                primary = 'always',
273                secondary = 'always',
274                tertiary = 'always',
275                unclassified = 'always',
276                residential = 'always',
277                road = 'always',
278                living_street = 'always',
279                pedestrian = 'always',
280                service = 'always',
281                cycleway = 'always',
282                path = 'always',
283                footway = 'always',
284                steps = 'always',
285                bridleway = 'always',
286                track = 'always',
287                motorway_link = 'always',
288                trunk_link = 'always',
289                primary_link = 'always',
290                secondary_link = 'always',
291                tertiary_link = 'always'}
292 }
293
294
295 -- name tags
296
297 module.NAME_TAGS = {}
298
299 module.NAME_TAGS.core = {main = {'name', 'name:*',
300                                  'int_name', 'int_name:*',
301                                  'nat_name', 'nat_name:*',
302                                  'reg_name', 'reg_name:*',
303                                  'loc_name', 'loc_name:*',
304                                  'old_name', 'old_name:*',
305                                  'alt_name', 'alt_name:*', 'alt_name_*',
306                                  'official_name', 'official_name:*',
307                                  'place_name', 'place_name:*',
308                                  'short_name', 'short_name:*'},
309                          extra = {'ref', 'int_ref', 'nat_ref', 'reg_ref',
310                                   'loc_ref', 'old_ref', 'ISO3166-2'}
311                         }
312 module.NAME_TAGS.address = {house = {'addr:housename'}}
313 module.NAME_TAGS.poi = {extra = {'ref', 'int_ref', 'nat_ref', 'reg_ref',
314                                        'loc_ref', 'old_ref',
315                                        'iata', 'icao',
316                                        'ISO3166-2'}}
317
318 -- Address tagging
319
320 module.ADDRESS_TAGS = {}
321
322 module.ADDRESS_TAGS.core = { extra = {'addr:*', 'is_in:*', 'tiger:county'},
323                              postcode = {'postal_code', 'postcode', 'addr:postcode',
324                                          'tiger:zip_left', 'tiger:zip_right'},
325                              country = {'country_code', 'ISO3166-1',
326                                         'addr:country_code', 'is_in:country_code',
327                                         'addr:country', 'is_in:country'}
328                            }
329
330 module.ADDRESS_TAGS.houses = { main = {'addr:housenumber',
331                                        'addr:conscriptionnumber',
332                                        'addr:streetnumber'},
333                                interpolation = {'addr:interpolation'}
334                              }
335
336 -- Ignored tags (prefiltered away)
337
338 module.IGNORE_KEYS = {}
339
340 module.IGNORE_KEYS.metatags = {'note', 'note:*', 'source', 'source:*', '*source',
341                                'attribution', 'comment', 'fixme', 'created_by',
342                                'tiger:cfcc', 'tiger:reviewed', 'nysgissam:*',
343                                'NHD:*', 'nhd:*', 'gnis:*', 'geobase:*', 'yh:*',
344                                'osak:*', 'naptan:*', 'CLC:*', 'import', 'it:fvg:*',
345                                'lacounty:*', 'ref:linz:*',
346                                'ref:bygningsnr', 'ref:ruian:*', 'building:ruian:type',
347                                'type',
348                                'is_in:postcode'}
349 module.IGNORE_KEYS.name = {'*:prefix', '*:suffix', 'name:prefix:*', 'name:suffix:*',
350                            'name:etymology', 'name:signed', 'name:botanical'}
351 module.IGNORE_KEYS.address = {'addr:street:*', 'addr:city:*', 'addr:district:*',
352                               'addr:province:*', 'addr:subdistrict:*', 'addr:place:*',
353                               'addr:TW:dataset'}
354
355 -- Extra tags (prefiltered away)
356
357 module.EXTRATAGS = {}
358
359 module.EXTRATAGS.required = {'wikipedia', 'wikipedia:*', 'wikidata', 'capital'}
360
361 return module