summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2011-10-12 19:47:43 +0200
committerJochen Topf <jochen@topf.org>2011-10-12 19:47:43 +0200
commitc4fe6f764a8ed74c4500993b5b62853c4bcdec4e (patch)
treeb0c98239f8c3d991e6c5f1a7eea2f092b0801844
parent37cdf05ea821f39f69ca023e9a4c02680bb772e4 (diff)
downloadtaginfo-c4fe6f764a8ed74c4500993b5b62853c4bcdec4e.tar
taginfo-c4fe6f764a8ed74c4500993b5b62853c4bcdec4e.tar.gz
Add config for distribution images.
New config options for the geographic distribution images.
-rwxr-xr-xsources/db/update.sh10
-rw-r--r--taginfo-config-example.json11
-rwxr-xr-xweb/taginfo.rb3
-rw-r--r--web/views/key.erb8
4 files changed, 24 insertions, 8 deletions
diff --git a/sources/db/update.sh b/sources/db/update.sh
index 19d3518..4d10894 100755
--- a/sources/db/update.sh
+++ b/sources/db/update.sh
@@ -38,10 +38,18 @@ echo "`$DATECMD` Running pre.sql..."
sqlite3 $DATABASE <pre.sql
echo "`$DATECMD` Running count... "
+
+top=`../../bin/taginfo-config.rb geodistribution.top`
+right=`../../bin/taginfo-config.rb geodistribution.right`
+bottom=`../../bin/taginfo-config.rb geodistribution.bottom`
+left=`../../bin/taginfo-config.rb geodistribution.left`
+width=`../../bin/taginfo-config.rb geodistribution.width`
+height=`../../bin/taginfo-config.rb geodistribution.height`
+
HERE=`pwd`
cd $DIR
#valgrind --leak-check=full --show-reachable=yes $HERE/tagstats $PLANETFILE >valgrind.log 2>&1
-$HERE/tagstats $PLANETFILE
+$HERE/tagstats --left=$left --bottom=$bottom --top=$top --right=$right --width=$width --height=$height $PLANETFILE
cd $HERE
echo "`$DATECMD` Running update_characters... "
diff --git a/taginfo-config-example.json b/taginfo-config-example.json
index ff2f0a2..9dbc624 100644
--- a/taginfo-config-example.json
+++ b/taginfo-config-example.json
@@ -13,10 +13,15 @@
"tagcloud": {
"number_of_tags": 200
},
- // For the geodistribution map. If you change this, you also have to change the C++ code in tagstats.
+ // For the geodistribution map. See the wiki documentation about these settings.
"geodistribution": {
- "width": 720,
- "height": 360,
+ "left": -180,
+ "bottom": -90,
+ "right": 180,
+ "top": 90,
+ "width": 360,
+ "height": 180,
+ "scale_image": 2,
"background_image": "/img/worldp.png"
},
"xapi": {
diff --git a/web/taginfo.rb b/web/taginfo.rb
index 2472030..d76c65d 100755
--- a/web/taginfo.rb
+++ b/web/taginfo.rb
@@ -212,6 +212,9 @@ class Taginfo < Sinatra::Base
@merkaartor_desc = @db.select('SELECT lang, description FROM key_descriptions').condition('key=?', @key).order_by(:lang).execute()
+ @img_width = TaginfoConfig.get('geodistribution.width') * TaginfoConfig.get('geodistribution.scale_image')
+ @img_height = TaginfoConfig.get('geodistribution.height') * TaginfoConfig.get('geodistribution.scale_image')
+
erb :key
end
diff --git a/web/views/key.erb b/web/views/key.erb
index 57d6de8..5f5ea45 100644
--- a/web/views/key.erb
+++ b/web/views/key.erb
@@ -51,16 +51,16 @@
<h2>Geographical distribution of this key</h2>
<% if @filter_type == 'all' %>
<div style="background-image: url(<%= TaginfoConfig.get('geodistribution.background_image') %>); background-repeat: no-repeat;"/>
- <img src="/api/3/db/keys/distribution/nodes?key=<%= @key_uri %>" alt="" width="<%= TaginfoConfig.get('geodistribution.width') %>" height="<%= TaginfoConfig.get('geodistribution.height') %>" style="position: absolute;"/>
- <img src="/api/3/db/keys/distribution/ways?key=<%= @key_uri %>" alt="" width="<%= TaginfoConfig.get('geodistribution.width') %>" height="<%= TaginfoConfig.get('geodistribution.height') %>"/>
+ <img src="/api/3/db/keys/distribution/nodes?key=<%= @key_uri %>" alt="" width="<%= @img_width %>" height="<%= @img_height %>" style="position: absolute;"/>
+ <img src="/api/3/db/keys/distribution/ways?key=<%= @key_uri %>" alt="" width="<%= @img_width %>" height="<%= @img_height %>"/>
</div>
<% elsif @filter_type == 'nodes' %>
<div style="background-image: url(<%= TaginfoConfig.get('geodistribution.background_image') %>); background-repeat: no-repeat;"/>
- <img src="/api/3/db/keys/distribution/nodes?key=<%= @key_uri %>" alt="" width="<%= TaginfoConfig.get('geodistribution.width') %>" height="<%= TaginfoConfig.get('geodistribution.height') %>"/>
+ <img src="/api/3/db/keys/distribution/nodes?key=<%= @key_uri %>" alt="" width="<%= @img_width %>" height="<%= @img_height %>"/>
</div>
<% elsif @filter_type == 'ways' %>
<div style="background-image: url(<%= TaginfoConfig.get('geodistribution.background_image') %>); background-repeat: no-repeat;"/>
- <img src="/api/3/db/keys/distribution/ways?key=<%= @key_uri %>" alt="" width="<%= TaginfoConfig.get('geodistribution.width') %>" height="<%= TaginfoConfig.get('geodistribution.height') %>"/>
+ <img src="/api/3/db/keys/distribution/ways?key=<%= @key_uri %>" alt="" width="<%= @img_width %>" height="<%= @img_height %>"/>
</div>
<% elsif @filter_type == 'relations' %>
<p><i>Relations do not have a geographical location, so no map can be shown.</i></p>