1 -- Nominatim themepark theme.
3 -- The Nominatim theme creates a fixed set of import tables for use with
4 -- Nominatim. Creation and object processing are directly controlled by
5 -- the theme. Topics provide preset configurations. You should add exactly
6 -- one topic to your project.
8 -- The theme also exports a number of functions that can be used to configure
9 -- its behaviour. These may be directly called in the style file after
10 -- importing the theme:
12 -- local nominatim = themepark:init_theme('nominatim')
13 -- nominatim.set_main_tags{boundary = 'always'}
15 -- This allows to write your own configuration from scratch. You can also
16 -- use it to customize topics. In that case, first add the topic, then
17 -- change the configuration:
19 -- themepark:add_topic('nominatim/full')
20 -- local nominatim = themepark:init_theme('nominatim')
21 -- nominatim.ignore_tags{'amenity'}
25 local MAIN_KEYS = {admin_level = {'delete'}}
26 local PRE_FILTER = {prefix = {}, suffix = {}}
28 local NAME_FILTER = nil
29 local ADDRESS_TAGS = {}
30 local ADDRESS_FILTER = nil
31 local EXTRATAGS_FILTER
32 local REQUIRED_EXTRATAGS_FILTER
33 local POSTCODE_FALLBACK = true
34 local ENTRANCE_FUNCTION = nil
36 -- This file can also be directly require'd instead of running it under
37 -- the themepark framework. In that case the first parameter is usually
38 -- the module name. Lets check for that, so that further down we can call
39 -- the low-level osm2pgsql functions instead of themepark functions.
41 if type(themepark) ~= 'table' then
45 -- The place tables carry the raw OSM information.
46 local table_definitions = {
48 ids = { type = 'any', id_column = 'osm_id', type_column = 'osm_type' },
50 { column = 'class', type = 'text', not_null = true },
51 { column = 'type', type = 'text', not_null = true },
52 { column = 'admin_level', type = 'smallint' },
53 { column = 'name', type = 'hstore' },
54 { column = 'address', type = 'hstore' },
55 { column = 'extratags', type = 'hstore' },
56 { column = 'geometry', type = 'geometry', projection = 'WGS84', not_null = true },
61 ids = { type = 'node', id_column = 'osm_id' },
63 { column = 'type', type = 'text', not_null = true },
64 { column = 'extratags', type = 'hstore' },
65 { column = 'geometry', type = 'geometry', projection = 'WGS84', not_null = true }
70 ids = { type = 'any', id_column = 'osm_id', type_column = 'osm_type' },
72 { column = 'postcode', type = 'text', not_null = true },
73 { column = 'country_code', type = 'text' },
74 { column = 'centroid', type = 'point', projection = 'WGS84', not_null = true },
75 { column = 'geometry', type = 'geometry', projection = 'WGS84' }
78 { column = 'postcode', method = 'btree' }
81 place_interpolation = {
82 ids = { type = 'way', id_column = 'osm_id' },
84 { column = 'type', type = 'text', not_null = true },
85 { column = 'address', type = 'hstore' },
86 { column = 'nodes', type = 'text', sql_type = 'bigint[]', not_null = true },
87 { column = 'geometry', type = 'linestring', projection = 'WGS84', not_null = true },
90 { column = 'nodes', method = 'gin' }
93 place_associated_street = {
94 ids = { type = 'relation', id_column = 'relation_id' },
96 { column = 'member_type', type = 'text', not_null = true },
97 { column = 'member_id', type = 'int8', not_null = true },
98 { column = 'member_role', type = 'text', not_null = true }
101 { column = { 'member_type', 'member_id' }, method = 'btree' }
106 local insert_row = {}
107 local script_path = debug.getinfo(1, "S").source:match("@?(.*/)")
108 local PRESETS = loadfile(script_path .. 'presets.lua')()
110 for table_name, table_definition in pairs(table_definitions) do
111 table_definition.name = table_name
112 table_definition.data_tablespace = os.getenv("NOMINATIM_TABLESPACE_PLACE_DATA")
113 table_definition.index_tablespace = os.getenv("NOMINATIM_TABLESPACE_PLACE_INDEX")
116 themepark:add_table(table_definition)
117 insert_row[table_name] = function(columns)
118 themepark:insert(table_name, columns, {}, {})
121 local place_table = osm2pgsql.define_table(table_definition)
122 insert_row[table_name] = function(columns)
123 place_table:insert(columns)
128 ------------ Geometry functions for relations ---------------------
130 function module.relation_as_multipolygon(o)
131 return o:as_multipolygon()
134 function module.relation_as_multiline(o)
135 return o:as_multilinestring():line_merge()
139 module.RELATION_TYPES = {
140 multipolygon = module.relation_as_multipolygon,
141 boundary = module.relation_as_multipolygon,
142 waterway = module.relation_as_multiline
145 --------- Built-in place transformation functions --------------------------
147 local PlaceTransform = {}
149 -- Special transform meanings which are interpreted elsewhere
150 PlaceTransform.fallback = 'fallback'
151 PlaceTransform.postcode_area = 'postcode_area'
152 PlaceTransform.delete = 'delete'
153 PlaceTransform.extra = 'extra'
155 -- always: unconditionally use that place
156 function PlaceTransform.always(place)
160 -- never: unconditionally drop the place
161 function PlaceTransform.never()
165 -- named: use the place if it has a fully-qualified name
166 function PlaceTransform.named(place)
167 if place.has_name then
172 -- named_with_key: use place if there is a name with the main key prefix
173 function PlaceTransform.named_with_key(place, k)
175 local prefix = k .. ':name'
176 for namek, namev in pairs(place.intags) do
177 if namek:sub(1, #prefix) == prefix
178 and (#namek == #prefix
179 or namek:sub(#prefix + 1, #prefix + 1) == ':') then
180 names[namek:sub(#k + 2)] = namev
184 if next(names) ~= nil then
185 return place:clone{names=names}
189 -- Special transform used with address fallbacks: ignore all names
190 -- except for those marked as being part of the address.
191 local function address_fallback(place)
192 if next(place.names) == nil or NAMES.house == nil then
197 for k, v in pairs(place.names) do
198 if NAME_FILTER(k, v) == 'house' then
202 return place:clone{names=names}
205 ----------------- other helper functions -----------------------------
207 local function lookup_prefilter_classification(k, v)
209 local desc = MAIN_KEYS[k]
210 local fullmatch = desc and (desc[v] or desc[1])
211 if fullmatch ~= nil then
215 for slen, slist in pairs(PRE_FILTER.suffix) do
217 local group = slist[k:sub(-slen)]
224 for slen, slist in pairs(PRE_FILTER.prefix) do
226 local group = slist[k:sub(1, slen)]
235 local function merge_filters_into_main(group, keys, tags)
237 for _, key in pairs(keys) do
238 -- ignore suffix and prefix matches
239 if key:sub(1, 1) ~= '*' and key:sub(#key, #key) ~= '*' then
240 if MAIN_KEYS[key] == nil then
243 MAIN_KEYS[key][1] = group
249 for key, values in pairs(tags) do
250 if MAIN_KEYS[key] == nil then
253 for _, v in pairs(values) do
254 MAIN_KEYS[key][v] = group
261 local function remove_group_from_main(group)
262 for key, values in pairs(MAIN_KEYS) do
263 for _, ttype in pairs(values) do
264 if ttype == group then
268 if next(values) == nil then
275 local function add_pre_filter(data)
276 for group, keys in pairs(data) do
277 for _, key in pairs(keys) do
278 local klen = #key - 1
279 if key:sub(1, 1) == '*' then
281 if PRE_FILTER.suffix[klen] == nil then
282 PRE_FILTER.suffix[klen] = {}
284 PRE_FILTER.suffix[klen][key:sub(2)] = group
286 elseif key:sub(#key, #key) == '*' then
287 if PRE_FILTER.prefix[klen] == nil then
288 PRE_FILTER.prefix[klen] = {}
290 PRE_FILTER.prefix[klen][key:sub(1, klen)] = group
296 ------------- Place class ------------------------------------------
299 Place.__index = Place
301 function Place.new(object, geom_func)
302 local self = setmetatable({}, Place)
304 self.geom_func = geom_func
306 self.admin_level = tonumber(self.object.tags.admin_level or 15) or 15
307 if self.admin_level == nil
308 or self.admin_level <= 0 or self.admin_level > 15
309 or math.floor(self.admin_level) ~= self.admin_level then
310 self.admin_level = 15
314 self.has_name = false
321 local has_main_tags = false
322 for k, v in pairs(self.object.tags) do
323 local group = lookup_prefilter_classification(k, v)
324 if group == 'extra' then
325 self.extratags[k] = v
326 elseif group ~= 'delete' then
334 if not has_main_tags then
335 -- no interesting tags, don't bother processing
342 function Place:clean(data)
343 for k, v in pairs(self.intags) do
344 if data.delete ~= nil and data.delete(k, v) then
346 elseif data.extra ~= nil and data.extra(k, v) then
347 self.extratags[k] = v
353 function Place:delete(data)
354 if data.match ~= nil then
355 for k, v in pairs(self.intags) do
356 if data.match(k, v) then
363 function Place:grab_extratags(data)
366 if data.match ~= nil then
367 for k, v in pairs(self.intags) do
368 if data.match(k, v) then
370 self.extratags[k] = v
379 local function strip_address_prefix(k)
380 if k:sub(1, 5) == 'addr:' then
384 if k:sub(1, 6) == 'is_in:' then
392 function Place:grab_address_parts(data)
395 if data.groups ~= nil then
396 for k, v in pairs(self.intags) do
397 local atype = data.groups(k, v)
400 if atype == 'main' then
402 self.address[strip_address_prefix(k)] = v
404 elseif atype == 'extra' then
405 self.address[strip_address_prefix(k)] = v
407 self.address[atype] = v
418 function Place:grab_name_parts(data)
421 if data.groups ~= nil then
422 for k, v in pairs(self.intags) do
423 local atype = data.groups(k, v)
428 if atype == 'main' then
430 elseif atype == 'house' then
432 fallback = {'place', 'house', address_fallback}
442 function Place:write_place(k, v, mfunc)
443 v = v or self.intags[k]
448 local place = mfunc(self, k, v)
450 local res = place:write_row(k, v)
451 self.num_entries = self.num_entries + res
459 function Place:geometry_is_valid()
460 if self.geometry == nil then
461 self.geometry = self.geom_func(self.object)
463 if self.geometry == nil or self.geometry:is_null() then
464 self.geometry = false
471 return self.geometry ~= false
475 function Place:write_row(k, v)
476 if not self:geometry_is_valid() then
480 local extra = EXTRATAGS_FILTER(self, k, v) or {}
482 for tk, tv in pairs(self.object.tags) do
483 if REQUIRED_EXTRATAGS_FILTER(tk, tv) and extra[tk] == nil then
488 if extra and next(extra) == nil then
495 admin_level = self.admin_level,
496 name = next(self.names) and self.names,
497 address = next(self.address) and self.address,
499 geometry = self.geometry
506 function Place:clone(data)
507 local cp = setmetatable({}, Place)
508 cp.object = self.object
509 cp.geometry = data.geometry or self.geometry
510 cp.geom_func = self.geom_func
511 cp.intags = data.intags or self.intags
512 cp.admin_level = data.admin_level or self.admin_level
513 cp.names = data.names or self.names
514 cp.address = data.address or self.address
515 cp.extratags = data.extratags or self.extratags
521 function module.tag_match(data)
522 if data == nil or next(data) == nil then
526 local fullmatches = {}
527 local key_prefixes = {}
528 local key_suffixes = {}
530 if data.keys ~= nil then
531 for _, key in pairs(data.keys) do
532 if key:sub(1, 1) == '*' then
534 if key_suffixes[#key - 1] == nil then
535 key_suffixes[#key - 1] = {}
537 key_suffixes[#key - 1][key:sub(2)] = true
539 elseif key:sub(#key, #key) == '*' then
540 if key_prefixes[#key - 1] == nil then
541 key_prefixes[#key - 1] = {}
543 key_prefixes[#key - 1][key:sub(1, #key - 1)] = true
545 fullmatches[key] = true
550 if data.tags ~= nil then
551 for k, vlist in pairs(data.tags) do
552 if fullmatches[k] == nil then
554 for _, v in pairs(vlist) do
555 fullmatches[k][v] = true
561 return function (k, v)
562 if fullmatches[k] ~= nil and (fullmatches[k] == true or fullmatches[k][v] ~= nil) then
566 for slen, slist in pairs(key_suffixes) do
567 if #k >= slen and slist[k:sub(-slen)] ~= nil then
572 for slen, slist in pairs(key_prefixes) do
573 if #k >= slen and slist[k:sub(1, slen)] ~= nil then
583 function module.tag_group(data)
584 if data == nil or next(data) == nil then
588 local fullmatches = {}
589 local key_prefixes = {}
590 local key_suffixes = {}
592 for group, tags in pairs(data) do
593 for _, key in pairs(tags) do
594 if key:sub(1, 1) == '*' then
596 if key_suffixes[#key - 1] == nil then
597 key_suffixes[#key - 1] = {}
599 key_suffixes[#key - 1][key:sub(2)] = group
601 elseif key:sub(#key, #key) == '*' then
602 if key_prefixes[#key - 1] == nil then
603 key_prefixes[#key - 1] = {}
605 key_prefixes[#key - 1][key:sub(1, #key - 1)] = group
607 fullmatches[key] = group
613 local val = fullmatches[k]
618 for slen, slist in pairs(key_suffixes) do
620 val = slist[k:sub(-slen)]
627 for slen, slist in pairs(key_prefixes) do
629 val = slist[k:sub(1, slen)]
638 -- Returns prefix part of the keys, and reject suffix matching keys
639 local function process_key(key)
640 if key:sub(1, 1) == '*' then
643 if key:sub(#key, #key) == '*' then
644 return key:sub(1, #key - 2)
649 -- Process functions for all data types
650 function module.process_node(object)
651 if ENTRANCE_FUNCTION ~= nil then
652 local entrance_info = ENTRANCE_FUNCTION(object)
653 if entrance_info ~= nil then
654 insert_row.place_entrance{
655 type = entrance_info.entrance,
656 extratags = entrance_info.extratags,
657 geometry = object:as_point()
662 local function geom_func(o)
666 module.process_tags(Place.new(object, geom_func))
669 function module.process_way(object)
671 local function geom_func(o)
672 local geom = o:as_polygon()
674 if geom:is_null() then
675 geom = o:as_linestring()
676 if geom:is_null() or geom:length() > 30 then
684 module.process_tags(Place.new(object, geom_func))
687 function module.process_relation(object)
688 if object.tags.type == 'associatedStreet' then
689 local has_street = false
690 for _, member in ipairs(object.members) do
691 -- Streets can only be ways or relations, not nodes
692 if member.role == 'street' and (member.type == 'w' or member.type == 'r') then
698 for _, member in ipairs(object.members) do
699 -- Only insert streets that are ways or relations
700 if member.role == 'street' and (member.type == 'w' or member.type == 'r') then
701 insert_row.place_associated_street{
702 member_type = member.type:upper(),
703 member_id = member.ref,
704 member_role = member.role
706 elseif member.role == 'house' then
707 insert_row.place_associated_street{
708 member_type = member.type:upper(),
709 member_id = member.ref,
710 member_role = member.role
717 local geom_func = module.RELATION_TYPES[object.tags.type]
719 if geom_func ~= nil then
720 module.process_tags(Place.new(object, geom_func))
724 -- The process functions are used by default by osm2pgsql.
726 themepark:add_proc('node', module.process_node)
727 themepark:add_proc('way', module.process_way)
728 themepark:add_proc('relation', module.process_relation)
730 osm2pgsql.process_node = module.process_node
731 osm2pgsql.process_way = module.process_way
732 osm2pgsql.process_relation = module.process_relation
735 function module.process_tags(o)
736 if next(o.intags) == nil then
737 return -- shortcut when pre-filtering has removed all tags
740 -- Exception for boundary/place double tagging
741 if o.intags.boundary == 'administrative' then
742 o:grab_extratags{match = function (k, v)
743 return k == 'place' and v:sub(1,3) ~= 'isl'
748 local fallback = o:grab_name_parts{groups=NAME_FILTER}
751 if o:grab_address_parts{groups=ADDRESS_FILTER} > 0 and fallback == nil then
752 fallback = {'place', 'house', address_fallback}
754 if o.address.country ~= nil and #o.address.country ~= 2 then
755 o.address['country'] = nil
758 if o.address.interpolation ~= nil and o.address.housenumber == nil
759 and o.object.type == 'way' and o.object.nodes ~= nil then
760 local extra_addr = nil
761 for k, v in pairs(o.address) do
762 if k ~= 'interpolation' then
763 if extra_addr == nil then
770 insert_row.place_interpolation{
771 type = o.address.interpolation,
772 address = extra_addr,
773 nodes = '{' .. table.concat(o.object.nodes, ',') .. '}',
774 geometry = o.object:as_linestring()
779 local postcode_collect = false
780 for k, v in pairs(o.intags) do
781 local ktable = MAIN_KEYS[k]
783 local ktype = ktable[v] or ktable[1]
784 if type(ktype) == 'function' then
785 o:write_place(k, v, ktype)
786 elseif ktype == 'postcode_area' then
787 postcode_collect = true
788 if o.object.type == 'relation'
789 and o.address.postcode ~= nil
790 and o:geometry_is_valid() then
791 insert_row.place_postcode{
792 postcode = o.address.postcode,
793 centroid = o.geometry:centroid(),
794 geometry = o.geometry
797 elseif ktype == 'fallback' and o.has_name then
798 fallback = {k, v, PlaceTransform.always}
803 if o.num_entries == 0 then
804 if fallback ~= nil then
805 o:write_place(fallback[1], fallback[2], fallback[3])
806 elseif POSTCODE_FALLBACK and not postcode_collect
807 and o.address.postcode ~= nil
808 and o:geometry_is_valid() then
809 insert_row.place_postcode{
810 postcode = o.address.postcode,
811 centroid = o.geometry:centroid()
817 --------- Extratags post-processing functions ---------------
819 local function default_extratags_filter(p, k)
823 EXTRATAGS_FILTER = default_extratags_filter
824 REQUIRED_EXTRATAGS_FILTER = module.tag_match(PRESETS.EXTRATAGS)
826 --------- Convenience functions for simple style configuration -----------------
828 function module.set_prefilters(data)
829 remove_group_from_main('delete')
830 merge_filters_into_main('delete', data.delete_keys, data.delete_tags)
832 remove_group_from_main('extra')
833 merge_filters_into_main('extra', data.extra_keys, data.extra_tags)
835 PRE_FILTER = {prefix = {}, suffix = {}}
836 add_pre_filter{delete = data.delete_keys, extra = data.extra_keys}
840 function module.ignore_keys(data)
841 if type(data) == 'string' then
843 data = PRESETS.IGNORE_KEYS[data]
845 error('Unknown preset for ignored keys: ' .. preset)
848 merge_filters_into_main('delete', data)
849 add_pre_filter{delete = data}
853 function module.add_for_extratags(data)
854 if type(data) == 'string' then
856 data = PRESETS.IGNORE_KEYS[data]
858 error('Unknown preset for extratags: ' .. preset)
861 merge_filters_into_main('extra', data)
862 add_pre_filter{extra = data}
866 function module.set_main_tags(data)
867 for key, values in pairs(MAIN_KEYS) do
868 for _, ttype in pairs(values) do
869 if ttype == 'fallback' or type(ttype) == 'function' then
873 if next(values) == nil then
877 module.modify_main_tags(data)
881 function module.modify_main_tags(data)
882 if type(data) == 'string' then
884 if data:sub(1, 7) == 'street/' then
885 data = PRESETS.MAIN_TAGS_STREETS[data:sub(8)]
886 elseif data:sub(1, 4) == 'poi/' then
887 data = PRESETS.MAIN_TAGS_POIS(data:sub(5))
889 data = PRESETS.MAIN_TAGS[data]
892 error('Unknown preset for main tags: ' .. preset)
896 for k, v in pairs(data) do
897 if MAIN_KEYS[k] == nil then
900 if type(v) == 'function' then
902 elseif type(v) == 'string' then
903 MAIN_KEYS[k][1] = PlaceTransform[v]
904 elseif type(v) == 'table' then
905 for subk, subv in pairs(v) do
906 if type(subv) == 'function' then
907 MAIN_KEYS[k][subk] = subv
909 MAIN_KEYS[k][subk] = PlaceTransform[subv]
917 function module.modify_name_tags(data)
918 if type(data) == 'string' then
920 data = PRESETS.NAME_TAGS[data]
922 error('Unknown preset for name keys: ' .. preset)
926 for k,v in pairs(data) do
933 NAME_FILTER = module.tag_group(NAMES)
934 remove_group_from_main('fallback:name')
935 if data.house ~= nil then
936 merge_filters_into_main('fallback:name', data.house)
941 function module.set_name_tags(data)
943 module.modify_name_tags(data)
947 function module.set_address_tags(data)
949 module.modify_address_tags(data)
953 function module.modify_address_tags(data)
954 if type(data) == 'string' then
956 data = PRESETS.ADDRESS_TAGS[data]
958 error('Unknown preset for address keys: ' .. preset)
962 for k, v in pairs(data) do
963 if k == 'postcode_fallback' then
964 POSTCODE_FALLBACK = v
965 elseif next(v) == nil then
966 ADDRESS_TAGS[k] = nil
972 ADDRESS_FILTER = module.tag_group(ADDRESS_TAGS)
974 remove_group_from_main('fallback:address')
975 merge_filters_into_main('fallback:address', data.main)
976 merge_filters_into_main('fallback:address', data.interpolation)
977 remove_group_from_main('fallback:postcode')
978 if POSTCODE_FALLBACK then
979 merge_filters_into_main('fallback:postcode', data.postcode)
984 function module.set_address_tags(data)
985 ADDRESS_TAGS_SOURCE = {}
986 module.modify_address_tags(data)
990 function module.set_postcode_fallback(enable)
991 if POSTCODE_FALLBACK ~= enable then
992 remove_group_from_main('fallback:postcode')
994 merge_filters_into_main('fallback:postcode', ADDRESS_TAGS.postcode)
997 POSTCODE_FALLBACK = enable
1001 function module.set_unused_handling(data)
1002 if type(data) == 'function' then
1003 EXTRATAGS_FILTER = data
1004 elseif data == nil then
1005 EXTRATAGS_FILTER = default_extratags_filter
1006 elseif data.extra_keys == nil and data.extra_tags == nil then
1007 local delfilter = module.tag_match{keys = data.delete_keys, tags = data.delete_tags}
1008 EXTRATAGS_FILTER = function (p, k)
1010 for kin, vin in pairs(p.intags) do
1011 if kin ~= k and not delfilter(kin, vin) then
1015 if next(extra) == nil then
1018 for kextra, vextra in pairs(p.extratags) do
1019 extra[kextra] = vextra
1023 elseif data.delete_keys == nil and data.delete_tags == nil then
1024 local incfilter = module.tag_match{keys = data.extra_keys, tags = data.extra_tags}
1025 EXTRATAGS_FILTER = function (p, k)
1027 for kin, vin in pairs(p.intags) do
1028 if kin ~= k and incfilter(kin, vin) then
1032 if next(extra) == nil then
1035 for kextra, vextra in pairs(p.extratags) do
1036 extra[kextra] = vextra
1041 error("unused handler can have only 'extra_keys' or 'delete_keys' set.")
1045 function module.set_relation_types(data)
1046 module.RELATION_TYPES = {}
1048 if v == 'multipolygon' then
1049 module.RELATION_TYPES[k] = module.relation_as_multipolygon
1050 elseif v == 'multiline' then
1051 module.RELATION_TYPES[k] = module.relation_as_multiline
1056 function module.set_entrance_filter(data)
1057 if data == nil or type(data) == 'function' then
1058 ENTRANCE_FUNCTION = data
1062 if type(data) == 'string' then
1064 data = PRESETS.ENTRANCE_TABLE[data]
1066 error('Unknown preset for entrance table: ' .. preset)
1070 ENTRANCE_FUNCTION = nil
1072 if data.main_tags ~= nil and next(data.main_tags) ~= nil then
1073 if data.extra_include ~= nil and next(data.extra_include) == nil then
1074 -- shortcut: no extra tags requested
1075 ENTRANCE_FUNCTION = function(o)
1076 for _, v in ipairs(data.main_tags) do
1077 if o.tags[v] ~= nil then
1078 return {entrance = o.tags[v]}
1084 if data.extra_include ~= nil then
1086 for _, v in pairs(data.extra_include) do
1089 if data.extra_exclude ~= nil then
1090 for _, v in pairs(data.extra_exclude) do
1094 for _, v in pairs(data.main_tags) do
1098 ENTRANCE_FUNCTION = function(o)
1099 for _, v in ipairs(data.main_tags) do
1100 if o.tags[v] ~= nil then
1101 local entrance = o.tags[v]
1103 for k, v in pairs(tags) do
1104 extra[k] = o.tags[k]
1106 if next(extra) == nil then
1109 return {entrance = entrance, extratags = extra}
1117 if data.extra_exclude ~= nil then
1118 for _, v in pairs(data.extra_exclude) do
1122 for _, v in pairs(data.main_tags) do
1126 ENTRANCE_FUNCTION = function(o)
1127 for _, v in ipairs(data.main_tags) do
1128 if o.tags[v] ~= nil then
1129 local entrance = o.tags[v]
1131 for k, v in pairs(o.tags) do
1132 if notags[k] ~= 1 then
1136 if next(extra) == nil then
1139 return {entrance = entrance, extratags = extra}
1150 function module.get_taginfo()
1151 return {main = MAIN_KEYS, name = NAMES, address = ADDRESS_TAGS}