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 flex = require('import-extratags')
10 local json = require ('dkjson')
13 ------------ helper functions ---------------------
15 function get_key_description(key, description)
18 desc.description = description
19 set_keyorder(desc, {'key', 'description'})
23 -- Sets the key order for the resulting JSON table
24 function set_keyorder(table, order)
31 -- Prints the collected tags in the required format in JSON
32 function print_taginfo()
35 for _, k in ipairs(flex.TAGINFO_MAIN.keys) do
36 local desc = get_key_description(k, 'POI/feature in the search database')
37 if flex.TAGINFO_MAIN.delete_tags[k] ~= nil then
38 desc.description = string.format('%s(except for values: %s).', desc.description,
39 table.concat(flex.TAGINFO_MAIN.delete_tags[k], ', '))
41 table.insert(tags, desc)
44 for k, _ in pairs(flex.TAGINFO_NAME_KEYS) do
45 local desc = get_key_description(k, 'Searchable name of the place.')
46 table.insert(tags, desc)
48 for k, _ in pairs(flex.TAGINFO_ADDRESS_KEYS) do
49 local desc = get_key_description(k, 'Used to determine the address of a place.')
50 table.insert(tags, desc)
55 data_url = 'https://nominatim.openstreetmap.org/taginfo.json',
58 description = 'OSM search engine.',
59 project_url = 'https://nominatim.openstreetmap.org',
60 doc_url = 'https://nominatim.org/release-docs/develop/',
61 contact_name = 'Sarah Hoffmann',
62 contact_email = 'lonvia@denofr.de'
67 set_keyorder(format, {'data_format', 'data_url', 'project', 'tags'})
68 set_keyorder(format.project, {'name', 'description', 'project_url', 'doc_url',
69 'contact_name', 'contact_email'})
71 print(json.encode(format))