diff options
author | Jochen Topf <jochen@topf.org> | 2013-01-07 14:19:44 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2013-01-07 14:19:44 +0100 |
commit | 9824e1ccb79a786ff011c6cbae999084e94fd984 (patch) | |
tree | 94022bd9f558fabae50355551e28e0579492ad69 /web/lib | |
parent | 8ea33d7296855e37f0f4ba9148167999dd2bbdfe (diff) | |
download | taginfo-9824e1ccb79a786ff011c6cbae999084e94fd984.tar taginfo-9824e1ccb79a786ff011c6cbae999084e94fd984.tar.gz |
Reorder api functions in source files alphabetically
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/api/v4/josm.rb | 38 | ||||
-rw-r--r-- | web/lib/api/v4/key.rb | 278 | ||||
-rw-r--r-- | web/lib/api/v4/search.rb | 82 | ||||
-rw-r--r-- | web/lib/api/v4/tag.rb | 144 |
4 files changed, 271 insertions, 271 deletions
diff --git a/web/lib/api/v4/josm.rb b/web/lib/api/v4/josm.rb index fff32d7..3cd6e0d 100644 --- a/web/lib/api/v4/josm.rb +++ b/web/lib/api/v4/josm.rb @@ -1,6 +1,25 @@ # web/lib/api/v4/josm.rb class Taginfo < Sinatra::Base + api(4, 'josm/style/image', { + :description => 'Access images for map features used in JOSM.', + :parameters => { + :style => 'JOSM style (required).', + :image => 'Image path (required).' + }, + :result => 'PNG image.', + :example => { :style => 'standard', :image => 'transport/bus.png' }, + :ui => '/keys/landuse#josm' + }) do + style = params[:style] + image = params[:image] + content_type :png + @db.select('SELECT png FROM josm.josm_style_images'). + condition('style = ?', style). + condition('path = ?', image). + get_first_value() + end + api(4, 'josm/style/rules', { :description => 'List rules and symbols in JOSM styles.', :parameters => { @@ -46,23 +65,4 @@ class Taginfo < Sinatra::Base return get_josm_style_rules_result(total, res); end - api(4, 'josm/style/image', { - :description => 'Access images for map features used in JOSM.', - :parameters => { - :style => 'JOSM style (required).', - :image => 'Image path (required).' - }, - :result => 'PNG image.', - :example => { :style => 'standard', :image => 'transport/bus.png' }, - :ui => '/keys/landuse#josm' - }) do - style = params[:style] - image = params[:image] - content_type :png - @db.select('SELECT png FROM josm.josm_style_images'). - condition('style = ?', style). - condition('path = ?', image). - get_first_value() - end - end diff --git a/web/lib/api/v4/key.rb b/web/lib/api/v4/key.rb index f4c3460..e61aa3f 100644 --- a/web/lib/api/v4/key.rb +++ b/web/lib/api/v4/key.rb @@ -1,42 +1,70 @@ # web/lib/api/v4/key.rb class Taginfo < Sinatra::Base - api(4, 'key/stats', { - :description => 'Show some database statistics for given key.', - :parameters => { :key => 'Tag key (required).' }, - :result => no_paging_results([ - [:type, :STRING, 'Object type ("all", "nodes", "ways", or "relations")'], - [:count, :INT, 'Number of objects with this type and key.'], - [:count_fraction, :FLOAT, 'Number of objects in relation to all objects.'], - [:values, :INT, 'Number of different values for this key.'] + api(4, 'key/combinations', { + :description => 'Find keys that are used together with a given key.', + :parameters => { + :key => 'Tag key (required).', + :query => 'Only show results where the other_key matches this query (substring match, optional).' + }, + :paging => :optional, + :filter => { + :all => { :doc => 'No filter.' }, + :nodes => { :doc => 'Only values on tags used on nodes.' }, + :ways => { :doc => 'Only values on tags used on ways.' }, + :relations => { :doc => 'Only values on tags used on relations.' } + }, + :sort => %w( together_count other_key from_fraction ), + :result => paging_results([ + [:other_key, :STRING, 'Other key.'], + [:together_count, :INT, 'Number of objects that have both keys.'], + [:to_fraction, :FLOAT, 'Fraction of objects with this key that also have the other key.'], + [:from_fraction, :FLOAT, 'Fraction of objects with other key that also have this key.'] ]), - :example => { :key => 'amenity' }, - :ui => '/keys/amenity#overview' + :example => { :key => 'highway', :page => 1, :rp => 10, :sortname => 'together_count', :sortorder => 'desc' }, + :ui => '/keys/highway#combinations' }) do key = params[:key] - out = [] + filter_type = get_filter() - # default values - ['all', 'nodes', 'ways', 'relations'].each_with_index do |type, n| - out[n] = { :type => type, :count => 0, :count_fraction => 0.0, :values => 0 } + if @ap.sortname == 'to_count' + @ap.sortname = ['together_count'] + elsif @ap.sortname == 'from_count' + @ap.sortname = ['from_fraction', 'together_count', 'other_key'] end - @db.select('SELECT * FROM db.keys'). + cq = @db.count('db.keypairs') + total = (params[:query].to_s != '' ? cq.condition("(key1 = ? AND key2 LIKE '%' || ? || '%') OR (key2 = ? AND key1 LIKE '%' || ? || '%')", key, params[:query], key, params[:query]) : cq.condition('key1 = ? OR key2 = ?', key, key)). + condition("count_#{filter_type} > 0"). + get_first_value().to_i + + has_this_key = @db.select("SELECT count_#{filter_type} FROM db.keys"). condition('key = ?', key). - execute() do |row| - ['all', 'nodes', 'ways', 'relations'].each_with_index do |type, n| - out[n] = { - :type => type, - :count => row['count_' + type].to_i, - :count_fraction => (row['count_' + type].to_f / get_total(type)).round_to(4), - :values => row['values_' + type].to_i - } - end - end + get_first_value() + + res = (params[:query].to_s != '' ? + @db.select("SELECT p.key1 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.keypairs p, db.keys k WHERE p.key1=k.key AND p.key2=? AND (p.key1 LIKE '%' || ? || '%') AND p.count_#{filter_type} > 0 + UNION SELECT p.key2 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.keypairs p, db.keys k WHERE p.key2=k.key AND p.key1=? AND (p.key2 LIKE '%' || ? || '%') AND p.count_#{filter_type} > 0", key, params[:query], key, params[:query]) : + @db.select("SELECT p.key1 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.keypairs p, db.keys k WHERE p.key1=k.key AND p.key2=? AND p.count_#{filter_type} > 0 + UNION SELECT p.key2 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.keypairs p, db.keys k WHERE p.key2=k.key AND p.key1=? AND p.count_#{filter_type} > 0", key, key)). + order_by(@ap.sortname, @ap.sortorder) { |o| + o.together_count + o.other_key + o.from_fraction + }. + paging(@ap). + execute() return { - :total => 4, - :data => out + :page => @ap.page, + :rp => @ap.results_per_page, + :total => total, + :data => res.map{ |row| { + :other_key => row['other_key'], + :together_count => row['together_count'].to_i, + :to_fraction => (row['together_count'].to_f / has_this_key.to_f).round_to(4), + :from_fraction => row['from_fraction'].to_f.round_to(4) + } } }.to_json end @@ -76,6 +104,90 @@ class Taginfo < Sinatra::Base get_first_value() end + api(4, 'key/josm/style/rules', { + :description => 'List rules and symbols for the given key in JOSM styles.', + :parameters => { + :style => 'JOSM style (required).', + :key => 'Tag key (required).', + :query => 'Only show results where the value matches this query (substring match, optional).' + }, + :paging => :optional, + :result => paging_results([ + [:key, :STRING, 'Key'], + [:value, :STRING, 'Value'], + [:value_bool, :STRING, '"yes" or "no". Null if the value is not boolean.'], + [:rule, :STRING, 'JOSM style rule in XML format.'], + [:area_color, :STRING, 'Fill color for area (if area rule).'], + [:line_color, :STRING, 'Stroke color for line (if line rule).'], + [:line_width, :INT, 'Line width (if line rule).'], + [:icon, :STRING, 'Icon path (if icon rule).'] + ]), + :example => { :style => 'standard', :key => 'highway', :page => 1, :rp => 10}, + :ui => '/keys/highway#josm' + }) do + style = params[:style] + key = params[:key] + + total = @db.count('josm_style_rules'). +# condition('style = ?', style). + condition('k = ?', key). + condition_if("v LIKE '%' || ? || '%'", params[:query]). + get_first_value().to_i + + res = @db.select('SELECT * FROM josm_style_rules'). +# condition('style = ?', style). + condition('k = ?', key). + condition_if("v LIKE '%' || ? || '%'", params[:query]). + order_by(@ap.sortname, @ap.sortorder) { |o| + o.value :v + o.value :b + o.b + }. + paging(@ap). + execute() + + return get_josm_style_rules_result(total, res); + end + + api(4, 'key/stats', { + :description => 'Show some database statistics for given key.', + :parameters => { :key => 'Tag key (required).' }, + :result => no_paging_results([ + [:type, :STRING, 'Object type ("all", "nodes", "ways", or "relations")'], + [:count, :INT, 'Number of objects with this type and key.'], + [:count_fraction, :FLOAT, 'Number of objects in relation to all objects.'], + [:values, :INT, 'Number of different values for this key.'] + ]), + :example => { :key => 'amenity' }, + :ui => '/keys/amenity#overview' + }) do + key = params[:key] + out = [] + + # default values + ['all', 'nodes', 'ways', 'relations'].each_with_index do |type, n| + out[n] = { :type => type, :count => 0, :count_fraction => 0.0, :values => 0 } + end + + @db.select('SELECT * FROM db.keys'). + condition('key = ?', key). + execute() do |row| + ['all', 'nodes', 'ways', 'relations'].each_with_index do |type, n| + out[n] = { + :type => type, + :count => row['count_' + type].to_i, + :count_fraction => (row['count_' + type].to_f / get_total(type)).round_to(4), + :values => row['values_' + type].to_i + } + end + end + + return { + :total => 4, + :data => out + }.to_json + end + api(4, 'key/values', { :description => 'Get values used with a given key.', :parameters => { @@ -161,73 +273,6 @@ class Taginfo < Sinatra::Base }.to_json end - api(4, 'key/combinations', { - :description => 'Find keys that are used together with a given key.', - :parameters => { - :key => 'Tag key (required).', - :query => 'Only show results where the other_key matches this query (substring match, optional).' - }, - :paging => :optional, - :filter => { - :all => { :doc => 'No filter.' }, - :nodes => { :doc => 'Only values on tags used on nodes.' }, - :ways => { :doc => 'Only values on tags used on ways.' }, - :relations => { :doc => 'Only values on tags used on relations.' } - }, - :sort => %w( together_count other_key from_fraction ), - :result => paging_results([ - [:other_key, :STRING, 'Other key.'], - [:together_count, :INT, 'Number of objects that have both keys.'], - [:to_fraction, :FLOAT, 'Fraction of objects with this key that also have the other key.'], - [:from_fraction, :FLOAT, 'Fraction of objects with other key that also have this key.'] - ]), - :example => { :key => 'highway', :page => 1, :rp => 10, :sortname => 'together_count', :sortorder => 'desc' }, - :ui => '/keys/highway#combinations' - }) do - key = params[:key] - filter_type = get_filter() - - if @ap.sortname == 'to_count' - @ap.sortname = ['together_count'] - elsif @ap.sortname == 'from_count' - @ap.sortname = ['from_fraction', 'together_count', 'other_key'] - end - - cq = @db.count('db.keypairs') - total = (params[:query].to_s != '' ? cq.condition("(key1 = ? AND key2 LIKE '%' || ? || '%') OR (key2 = ? AND key1 LIKE '%' || ? || '%')", key, params[:query], key, params[:query]) : cq.condition('key1 = ? OR key2 = ?', key, key)). - condition("count_#{filter_type} > 0"). - get_first_value().to_i - - has_this_key = @db.select("SELECT count_#{filter_type} FROM db.keys"). - condition('key = ?', key). - get_first_value() - - res = (params[:query].to_s != '' ? - @db.select("SELECT p.key1 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.keypairs p, db.keys k WHERE p.key1=k.key AND p.key2=? AND (p.key1 LIKE '%' || ? || '%') AND p.count_#{filter_type} > 0 - UNION SELECT p.key2 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.keypairs p, db.keys k WHERE p.key2=k.key AND p.key1=? AND (p.key2 LIKE '%' || ? || '%') AND p.count_#{filter_type} > 0", key, params[:query], key, params[:query]) : - @db.select("SELECT p.key1 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.keypairs p, db.keys k WHERE p.key1=k.key AND p.key2=? AND p.count_#{filter_type} > 0 - UNION SELECT p.key2 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.keypairs p, db.keys k WHERE p.key2=k.key AND p.key1=? AND p.count_#{filter_type} > 0", key, key)). - order_by(@ap.sortname, @ap.sortorder) { |o| - o.together_count - o.other_key - o.from_fraction - }. - paging(@ap). - execute() - - return { - :page => @ap.page, - :rp => @ap.results_per_page, - :total => total, - :data => res.map{ |row| { - :other_key => row['other_key'], - :together_count => row['together_count'].to_i, - :to_fraction => (row['together_count'].to_f / has_this_key.to_f).round_to(4), - :from_fraction => row['from_fraction'].to_f.round_to(4) - } } - }.to_json - end - api(4, 'key/wiki_pages', { :description => 'Get list of wiki pages in different languages describing a key.', :parameters => { :key => 'Tag key (required)' }, @@ -257,49 +302,4 @@ class Taginfo < Sinatra::Base return get_wiki_result(res) end - api(4, 'key/josm/style/rules', { - :description => 'List rules and symbols for the given key in JOSM styles.', - :parameters => { - :style => 'JOSM style (required).', - :key => 'Tag key (required).', - :query => 'Only show results where the value matches this query (substring match, optional).' - }, - :paging => :optional, - :result => paging_results([ - [:key, :STRING, 'Key'], - [:value, :STRING, 'Value'], - [:value_bool, :STRING, '"yes" or "no". Null if the value is not boolean.'], - [:rule, :STRING, 'JOSM style rule in XML format.'], - [:area_color, :STRING, 'Fill color for area (if area rule).'], - [:line_color, :STRING, 'Stroke color for line (if line rule).'], - [:line_width, :INT, 'Line width (if line rule).'], - [:icon, :STRING, 'Icon path (if icon rule).'] - ]), - :example => { :style => 'standard', :key => 'highway', :page => 1, :rp => 10}, - :ui => '/keys/highway#josm' - }) do - style = params[:style] - key = params[:key] - - total = @db.count('josm_style_rules'). -# condition('style = ?', style). - condition('k = ?', key). - condition_if("v LIKE '%' || ? || '%'", params[:query]). - get_first_value().to_i - - res = @db.select('SELECT * FROM josm_style_rules'). -# condition('style = ?', style). - condition('k = ?', key). - condition_if("v LIKE '%' || ? || '%'", params[:query]). - order_by(@ap.sortname, @ap.sortorder) { |o| - o.value :v - o.value :b - o.b - }. - paging(@ap). - execute() - - return get_josm_style_rules_result(total, res); - end - end diff --git a/web/lib/api/v4/search.rb b/web/lib/api/v4/search.rb index e41165d..f692672 100644 --- a/web/lib/api/v4/search.rb +++ b/web/lib/api/v4/search.rb @@ -1,47 +1,6 @@ # web/lib/api/v4/search.rb class Taginfo < Sinatra::Base - api(4, 'search/by_value', { - :description => 'Search for tags by value.', - :parameters => { :query => 'Value to search for (substring search, required).' }, - :sort => %w( count_all key value ), - :paging => :optional, - :result => paging_results([ - [:key, :STRING, 'Key'], - [:value, :STRING, 'Value'], - [:count_all, :INT, 'Number of objects in the database with this tag.'] - ]), - :example => { :query => 'foo', :page => 1, :rp => 10 }, - :ui => '/search?q=foo#values' - }) do - query = params[:query] - - total = @db.count('search.ftsearch'). - condition_if("value MATCH ?", query). - get_first_value().to_i - - res = @db.select('SELECT * FROM search.ftsearch'). - condition_if("value MATCH ?", query). - order_by(@ap.sortname, @ap.sortorder) { |o| - o.count_all - o.key - o.value - }. - paging(@ap). - execute() - - return { - :page => @ap.page, - :rp => @ap.results_per_page, - :total => total, - :data => res.map{ |row| { - :key => row['key'], - :value => row['value'], - :count_all => row['count_all'].to_i, - }} - }.to_json - end - api(4, 'search/by_key_and_value', { :description => 'Search for tags by key and/or value.', :parameters => { :query => 'Value to search for (substring search, required).' }, @@ -126,4 +85,45 @@ class Taginfo < Sinatra::Base }.to_json end + api(4, 'search/by_value', { + :description => 'Search for tags by value.', + :parameters => { :query => 'Value to search for (substring search, required).' }, + :sort => %w( count_all key value ), + :paging => :optional, + :result => paging_results([ + [:key, :STRING, 'Key'], + [:value, :STRING, 'Value'], + [:count_all, :INT, 'Number of objects in the database with this tag.'] + ]), + :example => { :query => 'foo', :page => 1, :rp => 10 }, + :ui => '/search?q=foo#values' + }) do + query = params[:query] + + total = @db.count('search.ftsearch'). + condition_if("value MATCH ?", query). + get_first_value().to_i + + res = @db.select('SELECT * FROM search.ftsearch'). + condition_if("value MATCH ?", query). + order_by(@ap.sortname, @ap.sortorder) { |o| + o.count_all + o.key + o.value + }. + paging(@ap). + execute() + + return { + :page => @ap.page, + :rp => @ap.results_per_page, + :total => total, + :data => res.map{ |row| { + :key => row['key'], + :value => row['value'], + :count_all => row['count_all'].to_i, + }} + }.to_json + end + end diff --git a/web/lib/api/v4/tag.rb b/web/lib/api/v4/tag.rb index 609a920..95e8a3e 100644 --- a/web/lib/api/v4/tag.rb +++ b/web/lib/api/v4/tag.rb @@ -1,48 +1,6 @@ # web/lib/api/v4/tag.rb class Taginfo < Sinatra::Base - api(4, 'tag/stats', { - :description => 'Show some database statistics for given tag.', - :parameters => { - :key => 'Tag key (required).', - :value => 'Tag value (required).' - }, - :result => no_paging_results([ - [:type, :STRING, 'Object type ("all", "nodes", "ways", or "relations")'], - [:count, :INT, 'Number of objects with this type and tag.'], - [:count_fraction, :FLOAT, 'Number of objects in relation to all objects.'] - ]), - :example => { :key => 'amenity', :value => 'school' }, - :ui => '/tags/amenity=school#overview' - }) do - key = params[:key] - value = params[:value] - out = [] - - # default values - ['all', 'nodes', 'ways', 'relations'].each_with_index do |type, n| - out[n] = { :type => type, :count => 0, :count_fraction => 0.0 } - end - - @db.select('SELECT * FROM db.tags'). - condition('key = ?', key). - condition('value = ?', value). - execute() do |row| - ['all', 'nodes', 'ways', 'relations'].each_with_index do |type, n| - out[n] = { - :type => type, - :count => row['count_' + type].to_i, - :count_fraction => (row['count_' + type].to_f / get_total(type)).round_to(4) - } - end - end - - return { - :total => 4, - :data => out - }.to_json - end - api(4, 'tag/combinations', { :description => 'Find keys and tags that are used together with a given tag.', :parameters => { @@ -125,36 +83,6 @@ class Taginfo < Sinatra::Base }.to_json end - api(4, 'tag/wiki_pages', { - :description => 'Get list of wiki pages in different languages describing a tag.', - :parameters => { :key => 'Tag key (required)', :value => 'Tag value (required).' }, - :paging => :no, - :result => no_paging_results([ - [:lang, :STRING, 'Language code.'], - [:language, :STRING, 'Language name in its language.'], - [:language_en, :STRING, 'Language name in English.'], - [:title, :STRING, 'Wiki page title.'], - [:description, :STRING, 'Short description of tag from wiki page.'], - [:image, :STRING, 'Wiki page title of associated image.'], - [:on_node, :BOOL, 'Is this a tag for nodes?'], - [:on_way, :BOOL, 'Is this a tag for ways?'], - [:on_area, :BOOL, 'Is this a tag for areas?'], - [:on_relation, :BOOL, 'Is this a tag for relations?'], - [:tags_implies, :ARRAY_OF_STRINGS, 'List of keys/tags implied by this tag.'], - [:tags_combination, :ARRAY_OF_STRINGS, 'List of keys/tags that can be combined with this tag.'], - [:tags_linked, :ARRAY_OF_STRINGS, 'List of keys/tags related to this tag.'] - ]), - :example => { :key => 'highway', :value => 'residential' }, - :ui => '/tags/highway=residential#wiki' - }) do - key = params[:key] - value = params[:value] - - res = @db.execute('SELECT * FROM wikipages WHERE key = ? AND value = ? ORDER BY lang', key, value) - - return get_wiki_result(res) - end - api(4, 'tag/josm/style/rules', { :description => 'List rules and symbols for the given tag in JOSM styles.', :parameters => { @@ -197,4 +125,76 @@ class Taginfo < Sinatra::Base return get_josm_style_rules_result(total, res); end + api(4, 'tag/stats', { + :description => 'Show some database statistics for given tag.', + :parameters => { + :key => 'Tag key (required).', + :value => 'Tag value (required).' + }, + :result => no_paging_results([ + [:type, :STRING, 'Object type ("all", "nodes", "ways", or "relations")'], + [:count, :INT, 'Number of objects with this type and tag.'], + [:count_fraction, :FLOAT, 'Number of objects in relation to all objects.'] + ]), + :example => { :key => 'amenity', :value => 'school' }, + :ui => '/tags/amenity=school#overview' + }) do + key = params[:key] + value = params[:value] + out = [] + + # default values + ['all', 'nodes', 'ways', 'relations'].each_with_index do |type, n| + out[n] = { :type => type, :count => 0, :count_fraction => 0.0 } + end + + @db.select('SELECT * FROM db.tags'). + condition('key = ?', key). + condition('value = ?', value). + execute() do |row| + ['all', 'nodes', 'ways', 'relations'].each_with_index do |type, n| + out[n] = { + :type => type, + :count => row['count_' + type].to_i, + :count_fraction => (row['count_' + type].to_f / get_total(type)).round_to(4) + } + end + end + + return { + :total => 4, + :data => out + }.to_json + end + + api(4, 'tag/wiki_pages', { + :description => 'Get list of wiki pages in different languages describing a tag.', + :parameters => { :key => 'Tag key (required)', :value => 'Tag value (required).' }, + :paging => :no, + :result => no_paging_results([ + [:lang, :STRING, 'Language code.'], + [:language, :STRING, 'Language name in its language.'], + [:language_en, :STRING, 'Language name in English.'], + [:title, :STRING, 'Wiki page title.'], + [:description, :STRING, 'Short description of tag from wiki page.'], + [:image, :STRING, 'Wiki page title of associated image.'], + [:on_node, :BOOL, 'Is this a tag for nodes?'], + [:on_way, :BOOL, 'Is this a tag for ways?'], + [:on_area, :BOOL, 'Is this a tag for areas?'], + [:on_relation, :BOOL, 'Is this a tag for relations?'], + [:tags_implies, :ARRAY_OF_STRINGS, 'List of keys/tags implied by this tag.'], + [:tags_combination, :ARRAY_OF_STRINGS, 'List of keys/tags that can be combined with this tag.'], + [:tags_linked, :ARRAY_OF_STRINGS, 'List of keys/tags related to this tag.'] + ]), + :example => { :key => 'highway', :value => 'residential' }, + :ui => '/tags/highway=residential#wiki' + }) do + key = params[:key] + value = params[:value] + + res = @db.execute('SELECT * FROM wikipages WHERE key = ? AND value = ? ORDER BY lang', key, value) + + return get_wiki_result(res) + end + end |