From 88e05f9a07f2761da3c331628933d84067711498 Mon Sep 17 00:00:00 2001 From: Konstantin Pastbin Date: Thu, 28 Dec 2023 09:21:53 +0200 Subject: [PATCH] [generator] Use piste:name and piste:ref if there is no other name/ref Signed-off-by: Konstantin Pastbin --- generator/osm2type.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/generator/osm2type.cpp b/generator/osm2type.cpp index 25a843ecf3..cee5142db1 100644 --- a/generator/osm2type.cpp +++ b/generator/osm2type.cpp @@ -1248,7 +1248,7 @@ void GetNameAndType(OsmElement * p, FeatureBuilderParams & params, }}, {"ref", "*", [¶ms](string & k, string & v) { - // Get reference (we process road numbers only). + // Get reference; its used for selected types only, see FeatureBuilder::PreSerialize(). params.ref = std::move(v); }}, {"layer", "*", [¶ms](string & k, string & v) @@ -1334,6 +1334,20 @@ void GetNameAndType(OsmElement * p, FeatureBuilderParams & params, params.SetPostcode(std::move(addrPostcode)); params.SetHouseNumberAndHouseName(std::move(houseNumber), std::move(houseName)); + // Fetch piste:name and piste:ref if there are no other name/ref values. + TagProcessor(p).ApplyRules( + { + {"piste:ref", "*", [¶ms](string & k, string & v) + { + if (params.ref.empty()) + params.ref = std::move(v); + }}, + {"piste:name", "*", [¶ms](string & k, string & v) + { + params.SetDefaultNameIfEmpty(std::move(v)); + }}, + }); + // Stage4: Match tags to classificator feature types via mapcss-mapping.csv. MatchTypes(p, params, filterType);