diff options
author | Jochen Topf <jochen@topf.org> | 2014-09-06 22:06:15 +0200 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2014-09-06 22:06:15 +0200 |
commit | 543a4a540b4f33e1933777a6bb47a3978bedf5c4 (patch) | |
tree | cd434ee461be10cba256e8a2fc5d6fa7b808afcf /sources/projects | |
parent | 056f9be8994e0b636d450fae19ebf10584614054 (diff) | |
download | taginfo-543a4a540b4f33e1933777a6bb47a3978bedf5c4.tar taginfo-543a4a540b4f33e1933777a6bb47a3978bedf5c4.tar.gz |
Project files can now contain a list of object types for each key/tag.
Diffstat (limited to 'sources/projects')
-rwxr-xr-x | sources/projects/parse.rb | 16 | ||||
-rw-r--r-- | sources/projects/pre.sql | 4 |
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, |