aboutsummaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2014-09-06 22:06:15 +0200
committerJochen Topf <jochen@topf.org>2014-09-06 22:06:15 +0200
commit543a4a540b4f33e1933777a6bb47a3978bedf5c4 (patch)
treecd434ee461be10cba256e8a2fc5d6fa7b808afcf /sources
parent056f9be8994e0b636d450fae19ebf10584614054 (diff)
downloadtaginfo-543a4a540b4f33e1933777a6bb47a3978bedf5c4.tar
taginfo-543a4a540b4f33e1933777a6bb47a3978bedf5c4.tar.gz
Project files can now contain a list of object types for each key/tag.
Diffstat (limited to 'sources')
-rwxr-xr-xsources/projects/parse.rb16
-rw-r--r--sources/projects/pre.sql4
2 files changed, 18 insertions, 2 deletions
diff --git a/sources/projects/parse.rb b/sources/projects/parse.rb
index c509fae..1471d0e 100755
--- a/sources/projects/parse.rb
+++ b/sources/projects/parse.rb
@@ -65,13 +65,25 @@ projects.each do |id, json|
if data[:tags]
data[:tags].each do |d|
- db.execute("INSERT INTO project_tags (project_id, key, value, description, doc_url, icon_url) VALUES (?, ?, ?, ?, ?, ?)",
+ on = { 'node' => 0, 'way' => 0, 'relation' => 0, 'area' => 0 }
+ if d[:object_types] && d[:object_types].class == Array
+ d[:object_types].each do |type|
+ on[type] = 1
+ end
+ else
+ on = { 'node' => 1, 'way' => 1, 'relation' => 1, 'area' => 1 }
+ end
+ db.execute("INSERT INTO project_tags (project_id, key, value, description, doc_url, icon_url, on_node, on_way, on_relation, on_area) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
id,
d[:key],
d[:value],
d[:description],
d[:doc_url],
- d[:icon_url]
+ d[:icon_url],
+ on['node'],
+ on['way'],
+ on['relation'],
+ on['area'],
);
end
end
diff --git a/sources/projects/pre.sql b/sources/projects/pre.sql
index da4d66f..6e4c0de 100644
--- a/sources/projects/pre.sql
+++ b/sources/projects/pre.sql
@@ -38,6 +38,10 @@ CREATE TABLE project_tags (
project_id TEXT NOT NULL,
key TEXT NOT NULL,
value TEXT,
+ on_node INTEGER,
+ on_way INTEGER,
+ on_relation INTEGER,
+ on_area INTEGER,
description TEXT,
doc_url TEXT,
icon_url TEXT,