From f8e708927375f49d7f598e9f5048ab4005610d36 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Wed, 7 Jun 2023 11:39:31 +0100 Subject: [PATCH] Revert "Change Street Map from WikiMedia to OpenStreetMap, as Wikimedia servers are no longer available. For #1709" This reverts commit 200e83a7e6b8155bcaacba0d918f621f18b736c8. --- plugins/feature/map/mapgui.cpp | 28 ------------------------- plugins/feature/map/mapgui.h | 1 - plugins/feature/map/osmtemplateserver.h | 16 +++++++------- 3 files changed, 8 insertions(+), 37 deletions(-) diff --git a/plugins/feature/map/mapgui.cpp b/plugins/feature/map/mapgui.cpp index 500bf3a814..d7e07ea688 100644 --- a/plugins/feature/map/mapgui.cpp +++ b/plugins/feature/map/mapgui.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #ifdef QT_WEBENGINE_FOUND #include @@ -214,8 +213,6 @@ MapGUI::MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur ui->map->setFormat(format); } - clearWikiMediaOSMCache(); - m_osmPort = 0; m_templateServer = new OSMTemplateServer(thunderforestAPIKey(), maptilerAPIKey(), m_osmPort); @@ -1109,31 +1106,6 @@ void MapGUI::clearOSMCache() } } -// Delete old cache if it might contain wikimedia OSM images before switch to using OSM directly -// as the images are different -void MapGUI::clearWikiMediaOSMCache() -{ - QSettings settings; - QString cacheCleared = "sdrangel.feature.map/cacheCleared"; - if (!settings.value(cacheCleared).toBool()) - { - qDebug() << "MapGUI::clearWikiMediaOSMCache: Clearing cache"; - QDir dir(osmCachePath()); - if (dir.exists()) - { - QStringList filenames = dir.entryList({"osm_100-l-1-*.png"}); - for (const auto& filename : filenames) - { - QFile file(dir.filePath(filename)); - if (!file.remove()) { - qDebug() << "MapGUI::clearWikiMediaOSMCache: Failed to remove " << file; - } - } - } - settings.setValue(cacheCleared, true); - } -} - void MapGUI::applyMap2DSettings(bool reloadMap) { ui->map->setVisible(m_settings.m_map2DEnabled); diff --git a/plugins/feature/map/mapgui.h b/plugins/feature/map/mapgui.h index 2834f49936..354388361d 100644 --- a/plugins/feature/map/mapgui.h +++ b/plugins/feature/map/mapgui.h @@ -218,7 +218,6 @@ class MapGUI : public FeatureGUI { void applyMap3DSettings(bool reloadMap); QString osmCachePath(); void clearOSMCache(); - void clearWikiMediaOSMCache(); void displaySettings(); bool handleMessage(const Message& message); void geoReply(); diff --git a/plugins/feature/map/osmtemplateserver.h b/plugins/feature/map/osmtemplateserver.h index 105aad1fe7..13b80d881a 100644 --- a/plugins/feature/map/osmtemplateserver.h +++ b/plugins/feature/map/osmtemplateserver.h @@ -71,14 +71,14 @@ private slots: { xml = QString("\ {\ - \"UrlTemplate\" : \"https://tile.openstreetmap.org/%z/%x/%y.png\",\ + \"UrlTemplate\" : \"https://maps.wikimedia.org/osm-intl/%z/%x/%y%1.png\",\ \"ImageFormat\" : \"png\",\ \"QImageFormat\" : \"Indexed8\",\ - \"ID\" : \"wmf-intl-1x\",\ - \"MaximumZoomLevel\" : 19,\ - \"MapCopyRight\" : \"OpenStreetMap\",\ - \"DataCopyRight\" : \"\"\ - }"); + \"ID\" : \"wmf-intl-%2x\",\ + \"MaximumZoomLevel\" : 18,\ + \"MapCopyRight\" : \"WikiMedia Foundation\",\ + \"DataCopyRight\" : \"OpenStreetMap contributors\"\ + }").arg(hiresURL).arg(hires ? 1 : 2); } else if (tokens[1] == "/satellite") { @@ -91,7 +91,7 @@ private slots: \"ID\" : \"usgs-l7\",\ \"MaximumZoomLevel\" : 20,\ \"MapCopyRight\" : \"Maptiler\",\ - \"DataCopyRight\" : \"\"\ + \"DataCopyRight\" : \"Maptiler\"\ }").arg(hiresURL).arg(m_maptilerAPIKey); } else if (tokens[1].contains("transit")) @@ -110,7 +110,7 @@ private slots: \"ID\" : \"%3\",\ \"MaximumZoomLevel\" : 20,\ \"MapCopyRight\" : \"CartoDB\",\ - \"DataCopyRight\" : \"\"\ + \"DataCopyRight\" : \"CartoDB\"\ }").arg(hiresURL).arg(mapUrl[idx]).arg(mapId[idx]); } else