summaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2011-12-28 19:36:42 +0100
committerJochen Topf <jochen@topf.org>2011-12-28 19:36:42 +0100
commit64d4f868ebdf36f96fe08fca9928a9d95c12cdc8 (patch)
tree4e8731da6f5081be0534ec5a46540ebf11142f57 /web/lib
parentafe1e7dacd7de22ea298a012f630acd883216063 (diff)
downloadtaginfo-64d4f868ebdf36f96fe08fca9928a9d95c12cdc8.tar
taginfo-64d4f868ebdf36f96fe08fca9928a9d95c12cdc8.tar.gz
JOSM images support improved
Add JOSM map feature images to taginfo-josm.db database and make accessible via API.
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/api/josm.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/web/lib/api/josm.rb b/web/lib/api/josm.rb
index ffd7e1d..70a0099 100644
--- a/web/lib/api/josm.rb
+++ b/web/lib/api/josm.rb
@@ -1,6 +1,22 @@
# web/lib/api/josm.rb
class Taginfo < Sinatra::Base
+ api(2, 'josm/styles/images', {
+ :description => 'Access images for map features used in JOSM.',
+ :parameters => { :style => 'JOSM style', :image => 'Image path' },
+ :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(2, 'josm/styles') do
# XXX dummy function
return [