From 45d424e8856f78c7a4c13d8f4e866d2b88856a05 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Fri, 26 Jun 2020 09:08:31 -0600 Subject: [PATCH] Dynamically produce source tags for Esri sources Signed-off-by: Taylor Smock --- .../mapwithai/data/mapwithai/MapWithAILayerInfo.java | 2 +- .../plugins/mapwithai/io/mapwithai/ESRISourceReader.java | 8 ++++++++ .../mapwithai/io/mapwithai/MapWithAISourceReader.java | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java index ccd7fb9..511fab3 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java @@ -61,7 +61,7 @@ public class MapWithAILayerInfo { public static final String CONFIG_PREFIX = "mapwithai.sources."; private static final String[] DEFAULT_LAYER_SITES = { - "https://gitlab.com/gokaart/JOSM_MapWithAI/-/raw/pages/public/json/sources.json" }; + "https://gokaart.gitlab.io/JOSM_MapWithAI/json/sources.json" }; /** Unique instance -- MUST be after DEFAULT_LAYER_SITES */ private static MapWithAILayerInfo instance; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/ESRISourceReader.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/ESRISourceReader.java index ebf1da4..7e416b2 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/ESRISourceReader.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/ESRISourceReader.java @@ -152,6 +152,14 @@ public class ESRISourceReader implements Closeable { newInfo.setAttributionText(feature.getString("accessInformation")); } newInfo.setDescription(feature.getString("snippet")); + if (newInfo.getSource() != null) { + StringBuilder sourceTag = new StringBuilder(newInfo.getSource()); + if (!sourceTag.toString().endsWith("/")) { + sourceTag.append('/'); + } + sourceTag.append(feature.getString("name", newInfo.getId())); + newInfo.setSource(sourceTag.toString()); + } return (newInfo); } diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReader.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReader.java index 4f538fb..1f50b8d 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReader.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReader.java @@ -131,6 +131,7 @@ public class MapWithAISourceReader implements Closeable { info.setConflationParameters(values.getJsonArray("conflationParameters")); info.setConflation(conflation); info.setConflationUrl(conflationUrl); + info.setSource(values.getString("source", null)); info.setAlreadyConflatedKey(alreadyConflatedKey); info.setCategory(MapWithAICategory.fromString(category)); if (values.containsKey("conflation_ignore_categories")) {