WIP: [styles] Add Turkey road shield #7153

Draft
ahmetlii wants to merge 4 commits from ahmetlii/master into master

View file

@ -72,6 +72,9 @@ std::unordered_map<std::string, RoadShieldType> const kRoadNetworkShields = {
{"pl:national", RoadShieldType::Generic_Red},
{"pl:regional", RoadShieldType::Generic_Orange},
{"pl:local", RoadShieldType::Generic_White},
{"tr:motorway", RoadShieldType::Generic_Orange},
{"tr:road", RoadShieldType::Generic_Blue},
{"tr:provincial", RoadShieldType::Generic_White},
vng commented 2024-01-13 11:34:01 +00:00 (Migrated from github.com)
Review

Where are these come from?
When I make the overpass query like "network"~"tr:" (https://overpass-turbo.eu/s/1FVM), I got nothing.

Where are these come from? When I make the overpass query like "network"~"tr:" (https://overpass-turbo.eu/s/1FVM), I got nothing.
ahmetlii commented 2024-01-13 11:47:40 +00:00 (Migrated from github.com)
Review

I didn't realize that it was case-sensitive and thought it wasn't strictly matching. Here are example relations:
TR:motorway
TR-roads
TR:provincial - only one available as a relation

I didn't realize that it was case-sensitive and thought it wasn't strictly matching. Here are example relations: [TR:motorway](https://www.openstreetmap.org/relation/153991) [TR-roads](https://www.openstreetmap.org/relation/1720464) [TR:provincial - only one available as a relation](https://www.openstreetmap.org/relation/16142889)
vng commented 2024-01-13 12:00:43 +00:00 (Migrated from github.com)
Review

Yes, the processing is case sensitive.
Fix TR and dash and add unit tests here: road_shields_parser_tests.cpp

Yes, the processing is case sensitive. Fix TR and dash and add unit tests here: road_shields_parser_tests.cpp
ahmetlii commented 2024-01-13 12:21:59 +00:00 (Migrated from github.com)
Review

Honestly, after thinking about it a bit more, the implementation can wait; because the data on OpenStreetMap is very inconsistent. There are many problems lying with motorway/state road relations, namely:

  • some motorway relations include their motorway_link junctions.
  • some portions of state roads are mapped with subsection number (example) on their ref tag.
  • there is no consistency with the variants of "D".
  • and finally, motorway sections on construction are included inside Turkish motorway road network relation or existing motorway relations, in turn which makes the situation worse.

I'd like to consult with the local community and take at least some action towards standardizing reference and relation tags, before going further with this pull request.

Honestly, after thinking about it a bit more, the implementation can wait; because the data on OpenStreetMap is very inconsistent. There are many problems lying with motorway/state road relations, namely: - some motorway relations include their motorway_link junctions. - some portions of state roads are mapped with subsection number ([example](https://www.openstreetmap.org/way/191189583)) on their ref tag. - there is no consistency with the variants of "D". - and finally, motorway sections on construction are included inside Turkish motorway road network relation or existing motorway relations, in turn which makes the situation worse. I'd like to consult with the local community and take at least some action towards standardizing reference and relation tags, before going further with this pull request.
vng commented 2024-01-13 13:08:14 +00:00 (Migrated from github.com)
Review

Ok, remove it for now.

Ok, remove it for now.
{"ua:national", RoadShieldType::Generic_Blue},
{"ua:regional", RoadShieldType::Generic_Blue},
{"ua:territorial", RoadShieldType::Generic_White},
@ -548,7 +551,7 @@ class CyprusRoadShieldParser : public SimpleRoadShieldParser
{
public:
explicit CyprusRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, {// North Cuprus.
: SimpleRoadShieldParser(baseRoadNumber, {// North Cyprus.
{"D.", RoadShieldType::Generic_Blue}, // White font.
{"GM.", RoadShieldType::Generic_White}, // Blue font.
{"GZ.", RoadShieldType::Generic_White}, // Blue font.
@ -565,6 +568,21 @@ public:
}
};
class TurkeyRoadShieldParser : public SimpleRoadShieldParser
//TODO: Implement provincial road shields, formatted as (province number, between 01-81)-(two digit number)
{
public:
explicit TurkeyRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, {
{"O-", RoadShieldType::Generic_Orange}, // Black font. Hexagon.
{"D.", RoadShieldType::Generic_Blue}, // White font.
{"D-", RoadShieldType::Generic_Blue}, // White font.
{"D", RoadShieldType::Generic_Blue}, // White font.
{"D ", RoadShieldType::Generic_Blue}}) // White font.
{
}
};
class MexicoRoadShieldParser : public RoadShieldParser
{
public:
@ -658,6 +676,8 @@ RoadShieldsSetT GetRoadShields(std::string const & mwmName, std::string const &
return MexicoRoadShieldParser(roadNumber).GetRoadShields();
if (mwmName == "Cyprus")
return CyprusRoadShieldParser(roadNumber).GetRoadShields();
if (mwmName == "Turkey")
return TurkeyRoadShieldParser(roadNumber).GetRoadShields();
return SimpleRoadShieldParser(roadNumber, SimpleRoadShieldParser::ShieldTypes()).GetRoadShields();
}