1 -- Prints taginfo project description in the standard output
4 -- create fake "osm2pgsql" table for flex-base, originally created by the main C++ program
6 function osm2pgsql.define_table(...) end
8 -- provide path to flex-style lua file
9 package.path = arg[0]:match("(.*/)") .. "?.lua;" .. package.path
10 local flex = require('import-extratags')
11 local json = require ('dkjson')
14 ------------ helper functions ---------------------
16 function get_key_description(key, description)
19 desc.description = description
20 set_keyorder(desc, {'key', 'description'})
24 -- Sets the key order for the resulting JSON table
25 function set_keyorder(table, order)
32 -- Prints the collected tags in the required format in JSON
33 function print_taginfo()
36 for _, k in ipairs(flex.TAGINFO_MAIN.keys) do
37 local desc = get_key_description(k, 'POI/feature in the search database')
38 if flex.TAGINFO_MAIN.delete_tags[k] ~= nil then
39 desc.description = string.format('%s (except for values: %s).', desc.description,
40 table.concat(flex.TAGINFO_MAIN.delete_tags[k], ', '))
42 table.insert(tags, desc)
45 for k, _ in pairs(flex.TAGINFO_NAME_KEYS) do
46 local desc = get_key_description(k, 'Searchable name of the place.')
47 table.insert(tags, desc)
49 for k, _ in pairs(flex.TAGINFO_ADDRESS_KEYS) do
50 local desc = get_key_description(k, 'Used to determine the address of a place.')
51 table.insert(tags, desc)
56 data_url = 'https://nominatim.openstreetmap.org/taginfo.json',
59 description = 'OSM search engine.',
60 project_url = 'https://nominatim.openstreetmap.org',
61 doc_url = 'https://nominatim.org/release-docs/develop/',
62 contact_name = 'Sarah Hoffmann',
63 contact_email = 'lonvia@denofr.de'
68 set_keyorder(format, {'data_format', 'data_url', 'project', 'tags'})
69 set_keyorder(format.project, {'name', 'description', 'project_url', 'doc_url',
70 'contact_name', 'contact_email'})
72 print(json.encode(format))