diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelGpx.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelGpx.java index bafb290f38c..e32035d9943 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelGpx.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelGpx.java @@ -14,8 +14,7 @@ import net.osmand.data.Amenity; import net.osmand.util.Algorithms; -import java.util.HashMap; -import java.util.Map; +import java.util.Set; import net.osmand.shared.gpx.GpxTrackAnalysis; @@ -65,6 +64,8 @@ public GpxTrackAnalysis getAnalysis() { return analysis; } + private static final Set doNotSaveWptTags = Set.of("route_id", "route_name"); + @NonNull @Override public WptPt createWptPt(@NonNull Amenity amenity, @Nullable String lang) { @@ -75,26 +76,24 @@ public WptPt createWptPt(@NonNull Amenity amenity, @Nullable String lang) { for (String obfTag : amenity.getAdditionalInfoKeys()) { String value = amenity.getAdditionalInfo(obfTag); if (!Algorithms.isEmpty(value)) { - String gpxTag = allowedPointObfToGpxTags.get(obfTag); - if (gpxTag != null) { - wptPt.getExtensionsToWrite().put(gpxTag, value); - } if (OBF_POINTS_GROUPS_CATEGORY.equals(obfTag)) { wptPt.setCategory(value); + } else if ("name".equals(obfTag)) { + wptPt.setName(value); + } else if ("description".equals(obfTag)) { + wptPt.setDesc(value); + } else if ("note".equals(obfTag)) { + wptPt.setComment(value); + } else if ("colour".equals(obfTag) && amenity.getAdditionalInfoKeys().contains("color")) { + // ignore "colour" if "color" exists + } else if (!doNotSaveWptTags.contains(obfTag)) { + wptPt.getExtensionsToWrite().put(obfTag, value); } } } return wptPt; } - private final static Map allowedPointObfToGpxTags = new HashMap<>(); - - static { - allowedPointObfToGpxTags.put("color", "color"); - allowedPointObfToGpxTags.put("gpx_icon", "icon"); - allowedPointObfToGpxTags.put("gpx_bg", "background"); - } - @NonNull @Override public String getPointFilterString() {