From 543a4a540b4f33e1933777a6bb47a3978bedf5c4 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Sat, 6 Sep 2014 22:06:15 +0200 Subject: Project files can now contain a list of object types for each key/tag. --- sources/projects/parse.rb | 16 ++++++++++++++-- sources/projects/pre.sql | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'sources') 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, -- cgit v1.2.3