Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/categories.txt2
-rw-r--r--data/mapcss-mapping.csv14
-rw-r--r--data/replaced_tags.txt11
-rw-r--r--defines.hpp2
-rw-r--r--generator/osm2type.cpp13
-rw-r--r--generator/osm_source.cpp15
-rw-r--r--generator/tag_admixer.hpp61
7 files changed, 93 insertions, 25 deletions
diff --git a/data/categories.txt b/data/categories.txt
index 1f96b393c4..5e4b5e579d 100644
--- a/data/categories.txt
+++ b/data/categories.txt
@@ -1887,7 +1887,7 @@ nb:3Museum|severdigheter
fi:3Museo|nähtävyydet
sw:Makumbusho|kivutio|utalii
-waterway-waterfall|natural-waterfall
+waterway-waterfall
en:2Waterfall|sights
cs:2Vodopád|zajímavost|pamětihodnost
sk:2Vodopád|pamätihodnosť
diff --git a/data/mapcss-mapping.csv b/data/mapcss-mapping.csv
index cec8dc1172..f1d9b9d16c 100644
--- a/data/mapcss-mapping.csv
+++ b/data/mapcss-mapping.csv
@@ -764,7 +764,7 @@ highway|footpath|no-access;[highway=footpath][access=no];x;name;int_name;763;hig
highway|footpath|tunnel;[highway=footpath][tunnel?];x;name;int_name;764;highway|footway
highway|footway|dike;[highway=footway][dike?];x;name;int_name;765;highway|footway
highway|footway|levee;[highway=footway][levee?];x;name;int_name;766;highway|footway
-highway|footway|no-access;[highway=footway][access=no];;name;int_name;767;highway|footway
+highway|footway|no-access;[highway=footway][access=no];x;name;int_name;767;highway|footway
highway|footway|t1;[highway=footway][t1];x;name;int_name;768;highway|footway
highway|footway|t3;[highway=footway][t3];x;name;int_name;769;highway|footway
highway|footway|t4;[highway=footway][t4];x;name;int_name;770;highway|footway
@@ -785,16 +785,16 @@ highway|motorway|levee;[highway=motorway][levee?];x;name;int_name;784;highway|mo
highway|motorway_link|cycleway;[highway=motorway_link][cycleway?];x;name;int_name;785;highway|motorway
highway|path|area-bicycle;[highway=path][area?][bicycle?];x;name;int_name;786;highway|path
highway|path|area-horse;[highway=path][area?][horse?];x;name;int_name;787;highway|path
-highway|path|bicycle-bridge;[highway=path][bicycle?][bridge?];;name;int_name;788;highway|path
-highway|path|bicycle-construction;[highway=path][bicycle?][construction?];x;name;int_name;789;highway|path
-highway|path|bicycle-disused;[highway=path][bicycle?][disused?];x;name;int_name;790;highway|path
-highway|path|bicycle-tunnel;[highway=path][bicycle?][tunnel?];;name;int_name;791;highway|path
+highway|path|bicycle-bridge;[highway=path][bicycle?][bridge?];x;name;int_name;788;highway|path|bicycle
+highway|path|bicycle-construction;[highway=path][bicycle?][construction?];x;name;int_name;789;highway|path|bicycle
+highway|path|bicycle-disused;[highway=path][bicycle?][disused?];x;name;int_name;790;highway|path|bicycle
+highway|path|bicycle-tunnel;[highway=path][bicycle?][tunnel?];x;name;int_name;791;highway|path|bicycle
highway|path|bridge-horse;[highway=path][bridge?][horse?];x;name;int_name;792;highway|path
highway|path|construction-horse;[highway=path][construction?][horse?];x;name;int_name;793;highway|path
highway|path|disused-horse;[highway=path][disused?][horse?];x;name;int_name;794;highway|path
highway|path|horse-tunnel;[highway=path][horse?][tunnel?];x;name;int_name;795;highway|path
highway|path|levee;[highway=path][levee?];x;name;int_name;796;highway|path
-highway|path|no-access;[highway=path][access=no];;name;int_name;797;highway|path
+highway|path|no-access;[highway=path][access=no];x;name;int_name;797;highway|path
highway|path|t4;[highway=path][t4];x;name;int_name;798;highway|path
highway|path|t6;[highway=path][t6];x;name;int_name;799;highway|path
highway|pedestrian|cycleway;[highway=pedestrian][cycleway];x;name;int_name;800;highway|pedestrian
@@ -954,7 +954,7 @@ amenity|ferry_terminal;[amenity=ferry_terminal];;name;int_name;953;
amenity;[amenity];;name;int_name;954;
shop|furniture;[shop=furniture];;name;int_name;955;
natural|grassland;[natural=grassland];;name;int_name;956;
-natural|waterfall;[natural=waterfall];;name;int_name;957;
+natural|waterfall;[natural=waterfall];x;name;int_name;957;waterway|waterfall
waterway|waterfall;[waterway=waterfall];;name;int_name;958;
railway|proposed;[railway=proposed];;name;int_name;959;
amenity|casino;[amenity=casino];;name;int_name;960;
diff --git a/data/replaced_tags.txt b/data/replaced_tags.txt
new file mode 100644
index 0000000000..f8138b0d18
--- /dev/null
+++ b/data/replaced_tags.txt
@@ -0,0 +1,11 @@
+atm=yes : amenity=atm
+restaurant=yes : amenity=restaurant
+hotel=yes : tourism=hotel
+building=entrance : entrance=yes
+
+natural=marsh : natural=wetland, wetland=marsh
+natural=waterfall : waterway=waterfall
+office=travel_agent : shop=travel_agency
+shop=tailor : craft=tailor
+shop=estate_agent : office=estate_agent
+amenity=swimming_pool : leisure=swimming_pool
diff --git a/defines.hpp b/defines.hpp
index 2caec0ac73..f19764f472 100644
--- a/defines.hpp
+++ b/defines.hpp
@@ -68,3 +68,5 @@
#define EXTERNAL_RESOURCES_FILE "external_resources.txt"
#define GPS_TRACK_FILENAME "gps_track.dat"
+
+#define PEPLACED_TAGS_FILE "replaced_tags.txt"
diff --git a/generator/osm2type.cpp b/generator/osm2type.cpp
index 3e718d5ac4..41b9df795f 100644
--- a/generator/osm2type.cpp
+++ b/generator/osm2type.cpp
@@ -399,8 +399,7 @@ namespace ftype
bool hasLayer = false;
char const * layer = nullptr;
- bool isSubwayEntrance = false;
- bool isSubwayStation = false;
+ bool isSubway = false;
TagProcessor(p).ApplyRules
({
@@ -408,20 +407,20 @@ namespace ftype
{ "tunnel", "yes", [&layer] { layer = "-1"; }},
{ "layer", "*", [&hasLayer] { hasLayer = true; }},
- { "railway", "subway_entrance", [&isSubwayEntrance] { isSubwayEntrance = true; }},
+ { "railway", "subway_entrance", [&isSubway] { isSubway = true; }},
/// @todo Unfortunatelly, it's not working in many cases (route=subway, transport=subway).
/// Actually, it's better to process subways after feature types assignment.
- { "station", "subway", [&isSubwayStation] { isSubwayStation = true; }},
+ { "station", "subway", [&isSubway] { isSubway = true; }},
});
if (!hasLayer && layer)
p->AddTag("layer", layer);
// Tag 'city' is needed for correct selection of metro icons.
- if (isSubwayEntrance || isSubwayStation)
+ if (isSubway && p->type == OsmElement::EntityType::Node)
{
- string const & city = MatchCity(p);
+ string const city = MatchCity(p);
if (!city.empty())
p->AddTag("city", city);
}
@@ -473,6 +472,8 @@ namespace ftype
highwayDone = true;
}
+ /// @tdo Probably, we can delete this processing because cities
+ /// are matched by limit rect in MatchCity.
if (!subwayDone && types.IsRwSubway(vTypes[i]))
{
TagProcessor(p).ApplyRules
diff --git a/generator/osm_source.cpp b/generator/osm_source.cpp
index a75bd84beb..9ab1bd322c 100644
--- a/generator/osm_source.cpp
+++ b/generator/osm_source.cpp
@@ -13,6 +13,9 @@
#include "generator/world_map_generator.hpp"
#include "indexer/classificator.hpp"
+
+#include "platform/platform.hpp"
+
#include "geometry/mercator.hpp"
#include "coding/parse_xml.hpp"
@@ -505,9 +508,17 @@ bool GenerateFeaturesImpl(feature::GenerateInfo & info)
bucketer, cache, info.m_makeCoasts ? classif().GetCoastType() : 0,
info.GetAddressesFileName());
- TagAdmixer tagAdmixer(info.GetIntermediateFileName("ways",".csv"), info.GetIntermediateFileName("towns",".csv"));
+ TagAdmixer tagAdmixer(info.GetIntermediateFileName("ways", ".csv"),
+ info.GetIntermediateFileName("towns", ".csv"));
+ TagReplacer tagReplacer(GetPlatform().ResourcesDir() + PEPLACED_TAGS_FILE);
+
// Here we can add new tags to element!!!
- auto fn = [&parser, &tagAdmixer](OsmElement * e) { parser.EmitElement(tagAdmixer(e)); };
+ auto fn = [&](OsmElement * e)
+ {
+ tagReplacer(e);
+ tagAdmixer(e);
+ parser.EmitElement(e);
+ };
SourceReader reader = info.m_osmFileName.empty() ? SourceReader() : SourceReader(info.m_osmFileName);
switch (info.m_osmFileType)
diff --git a/generator/tag_admixer.hpp b/generator/tag_admixer.hpp
index 227432209a..802a8c72b7 100644
--- a/generator/tag_admixer.hpp
+++ b/generator/tag_admixer.hpp
@@ -3,6 +3,7 @@
#include "generator/osm_element.hpp"
#include "base/logging.hpp"
+#include "base/stl_add.hpp"
#include "base/string_utils.hpp"
#include "std/fstream.hpp"
@@ -101,18 +102,13 @@ public:
}
}
- OsmElement * operator()(OsmElement * e)
+ void operator()(OsmElement * e)
{
- if (e == nullptr)
- return e;
if (e->type == OsmElement::EntityType::Way && m_ways.find(e->id) != m_ways.end())
{
// Exclude ferry routes.
- if (find(e->Tags().begin(), e->Tags().end(), m_ferryTag) != e->Tags().end())
- return e;
-
- e->AddTag("highway", m_ways[e->id]);
- return e;
+ if (find(e->Tags().begin(), e->Tags().end(), m_ferryTag) == e->Tags().end())
+ e->AddTag("highway", m_ways[e->id]);
}
else if (e->type == OsmElement::EntityType::Node && m_capitals.find(e->id) != m_capitals.end())
{
@@ -126,7 +122,6 @@ public:
v = "45000";
});
}
- return e;
}
private:
@@ -134,3 +129,51 @@ private:
set<uint64_t> m_capitals;
OsmElement::Tag const m_ferryTag;
};
+
+class TagReplacer
+{
+ vector<vector<string>> m_entries;
+public:
+ TagReplacer(string const & filePath)
+ {
+ try
+ {
+ ifstream stream(filePath);
+ while (stream.good())
+ {
+ string line;
+ std::getline(stream, line);
+ if (line.empty())
+ continue;
+
+ vector<string> v;
+ strings::Tokenize(line, " \t=,:", MakeBackInsertFunctor(v));
+ if (v.size() < 4 || v.size() % 2 == 1)
+ continue;
+
+ m_entries.push_back(move(v));
+ }
+ }
+ catch (ifstream::failure const &)
+ {
+ LOG(LWARNING, ("Can't read replacing tags info file", filePath));
+ }
+ }
+
+ void operator()(OsmElement * p)
+ {
+ for (auto & tag : p->m_tags)
+ {
+ for (auto const & entry : m_entries)
+ {
+ if (tag.key == entry[0] && tag.value == entry[1])
+ {
+ tag.key = entry[2];
+ tag.value = entry[3];
+ for (size_t i = 4; i < entry.size(); i += 2)
+ p->AddTag(entry[i], entry[i+1]);
+ }
+ }
+ }
+ }
+};