From 91776c5ba709eeb06e9cc731de92f43dbf7b0108 Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Thu, 28 Jun 2018 16:19:29 +0300 Subject: [PATCH] [types] Add attraction subtypes --- data/classificator.txt | 24 +++++++++++++++++---- data/mapcss-mapping.csv | 12 +++++++++++ data/types.txt | 12 +++++++++++ data/visibility.txt | 24 +++++++++++++++++---- generator/osm2type.cpp | 47 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 111 insertions(+), 8 deletions(-) diff --git a/data/classificator.txt b/data/classificator.txt index 7831a1afdc..2e940bf2ac 100644 --- a/data/classificator.txt +++ b/data/classificator.txt @@ -371,10 +371,17 @@ world + archaeological_site - battlefield - boundary_stone - - castle - + castle + + defensive - + stately - + {} citywalls - fort - - memorial - + memorial + + plaque - + sculpture - + statue - + {} monument - museum - ruins - @@ -627,6 +634,7 @@ world + ocean - region - sea - + square - state + USA - {} @@ -918,8 +926,16 @@ world + tourism + alpine_hut - apartment - - artwork - - attraction - + artwork + + architecture - + painting - + sculpture - + statue - + {} + attraction + + animal - + specified - + {} camp_site - caravan_site - chalet - diff --git a/data/mapcss-mapping.csv b/data/mapcss-mapping.csv index b3d59cc0a0..6c4bdc7f9d 100644 --- a/data/mapcss-mapping.csv +++ b/data/mapcss-mapping.csv @@ -1223,3 +1223,15 @@ sponsored|partner17;1222; sponsored|partner18;1223; sponsored|partner19;1224; sponsored|partner20;1225; +place|square;1226; +tourism|artwork|architecture;[tourism=artwork][artwork_type=architecture];;name;int_name;1227; +tourism|artwork|sculpture;[tourism=artwork][artwork_type=sculpture];;name;int_name;1228; +tourism|artwork|statue;[tourism=artwork][artwork_type=statue];;name;int_name;1229; +tourism|artwork|painting;[tourism=artwork][artwork_type=painting];;name;int_name;1230; +historic|memorial|sculpture;[historic=memorial][memorial=sculpture];;name;int_name;1231; +historic|memorial|statue;[historic=memorial][memorial=statue];;name;int_name;1232; +historic|memorial|plaque;[historic=memorial][memorial=plaque];;name;int_name;1233; +historic|castle|defensive;[historic=castle][castle_type=defensive];;name;int_name;1234; +historic|castle|stately;[historic=castle][castle_type=stately];;name;int_name;1235; +tourism|attraction|animal;[tourism=attraction][attraction=animal];;name;int_name;1236; +tourism|attraction|specified;[tourism=attraction][attraction=specified];;name;int_name;1237; diff --git a/data/types.txt b/data/types.txt index 3dab12e50e..c7621dcca3 100644 --- a/data/types.txt +++ b/data/types.txt @@ -1223,3 +1223,15 @@ sponsored|partner17 sponsored|partner18 sponsored|partner19 sponsored|partner20 +place|square +tourism|artwork|architecture +tourism|artwork|sculpture +tourism|artwork|statue +tourism|artwork|painting +historic|memorial|sculpture +historic|memorial|statue +historic|memorial|plaque +historic|castle|defensive +historic|castle|stately +tourism|attraction|animal +tourism|attraction|specified diff --git a/data/visibility.txt b/data/visibility.txt index 2b72fddbea..406d4ab954 100644 --- a/data/visibility.txt +++ b/data/visibility.txt @@ -371,10 +371,17 @@ world 00000000000000000000 + archaeological_site 00000000000000000111 - battlefield 00000000000000000000 - boundary_stone 00000000000000001111 - - castle 00000000000011111111 - + castle 00000000000011111111 + + defensive 00000000000011111111 - + stately 00000000000011111111 - + {} citywalls 00000000000000000000 - fort 00000000000011111111 - - memorial 00000000000000011111 - + memorial 00000000000000011111 + + plaque 00000000000000011111 - + sculpture 00000000000000011111 - + statue 00000000000000011111 - + {} monument 00000000000001111111 - museum 00000000000000001111 - ruins 00000000000000000111 - @@ -627,6 +634,7 @@ world 00000000000000000000 + ocean 01111111111111111111 - region 00000000110000000000 - sea 00001111111111111111 - + square 00000000000000000000 - state 00000011111000000000 + USA 00000111111000000000 - {} @@ -918,8 +926,16 @@ world 00000000000000000000 + tourism 00000000000000000000 + alpine_hut 00000000000000000000 - apartment 00000000000000000000 - - artwork 00000000000000011111 - - attraction 00000000000000011111 - + artwork 00000000000000011111 + + architecture 00000000000000011111 - + painting 00000000000000011111 - + sculpture 00000000000000011111 - + statue 00000000000000011111 - + {} + attraction 00000000000000011111 + + animal 00000000000000011111 - + specified 00000000000000011111 - + {} camp_site 00000000000000000000 - caravan_site 00000000000000000000 - chalet 00000000000000000000 - diff --git a/generator/osm2type.cpp b/generator/osm2type.cpp index 718cc285c6..957b536263 100644 --- a/generator/osm2type.cpp +++ b/generator/osm2type.cpp @@ -537,6 +537,53 @@ namespace ftype break; } } + + // Merge attraction and memorial types to predefined set of values + p->UpdateTag("artwork_type", [](string & value) { + if (value.empty()) + return; + if (value == "mural" || value == "graffiti" || value == "azulejo" || value == "tilework") + value = "painting"; + else if (value == "stone" || value == "installation") + value = "sculpture"; + else if (value == "bust") + value = "statue"; + }); + + string const & memorialType = p->GetTag("memorial:type"); + p->UpdateTag("memorial", [&memorialType](string & value) { + if (value.empty()) { + if (memorialType.empty()) + return; + else + value = memorialType; + } + + if (value == "blue_plaque" || value == "stolperstein") + value = "plaque"; + else if (value == "war_memorial" || value == "stele" || value == "obelisk" || + value == "stone" || value == "cross") + value = "sculpture"; + else if (value == "bust" || value == "person") + value = "statue"; + }); + + p->UpdateTag("castle_type", [](string & value) { + if (value.empty()) + return; + if (value == "fortress" || value == "kremlin" || value == "castrum" || + value == "shiro" || value == "citadel") + value = "defensive"; + else if (value == "manor" || value == "palace") + value = "stately"; + }); + + p->UpdateTag("attraction", [](string & value) { + // "specified" is a special value which means we have the "attraction" tag, + // but its value is not "animal". + if (!value.empty() && value != "animal") + value = "specified"; + }); } void PostprocessElement(OsmElement * p, FeatureParams & params)