Skip to content

Commit

Permalink
Revert "Change Street Map from WikiMedia to OpenStreetMap, as Wikimed…
Browse files Browse the repository at this point in the history
…ia servers are no longer available. For f4exb#1709"

This reverts commit 200e83a.
  • Loading branch information
srcejon committed Jun 7, 2023
1 parent 200e83a commit f8e7089
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 37 deletions.
28 changes: 0 additions & 28 deletions plugins/feature/map/mapgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <QGeoCoordinate>
#include <QGeoCodingManager>
#include <QGeoServiceProvider>
#include <QSettings>

#ifdef QT_WEBENGINE_FOUND
#include <QtWebEngineWidgets/QWebEngineView>
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion plugins/feature/map/mapgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 8 additions & 8 deletions plugins/feature/map/osmtemplateserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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\" : \"<a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>\",\
\"DataCopyRight\" : \"\"\
}");
\"ID\" : \"wmf-intl-%2x\",\
\"MaximumZoomLevel\" : 18,\
\"MapCopyRight\" : \"<a href='https://wikimediafoundation.org/wiki/Terms_of_Use'>WikiMedia Foundation</a>\",\
\"DataCopyRight\" : \"<a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors\"\
}").arg(hiresURL).arg(hires ? 1 : 2);
}
else if (tokens[1] == "/satellite")
{
Expand All @@ -91,7 +91,7 @@ private slots:
\"ID\" : \"usgs-l7\",\
\"MaximumZoomLevel\" : 20,\
\"MapCopyRight\" : \"<a href='http://maptiler.com/'>Maptiler</a>\",\
\"DataCopyRight\" : \"\"\
\"DataCopyRight\" : \"<a href='http://maptiler.com'>Maptiler</a>\"\
}").arg(hiresURL).arg(m_maptilerAPIKey);
}
else if (tokens[1].contains("transit"))
Expand All @@ -110,7 +110,7 @@ private slots:
\"ID\" : \"%3\",\
\"MaximumZoomLevel\" : 20,\
\"MapCopyRight\" : \"<a href='https://carto.com'>CartoDB</a>\",\
\"DataCopyRight\" : \"\"\
\"DataCopyRight\" : \"<a href='https://carto.com'>CartoDB</a>\"\
}").arg(hiresURL).arg(mapUrl[idx]).arg(mapId[idx]);
}
else
Expand Down

0 comments on commit f8e7089

Please sign in to comment.