summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-10-16 11:59:17 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-10-16 03:43:02 -0800
commit5b415ad8dbee94bcdd8ab1970cb8f2c188fffea5 (patch)
treefeefdff5dad30598971da8a2f50e38d077add75d
parentae87985b8fcdcdd6e3cfc2a145be2baef78565c3 (diff)
downloadsubsurface-5b415ad8dbee94bcdd8ab1970cb8f2c188fffea5.tar.gz
Reverse geo lookup string for http://api.geonames.org corrected
Language selection should now work again with string "lang=xx". Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
-rw-r--r--core/divesitehelpers.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/divesitehelpers.cpp b/core/divesitehelpers.cpp
index f9ece95e4..9eefc2a6c 100644
--- a/core/divesitehelpers.cpp
+++ b/core/divesitehelpers.cpp
@@ -35,8 +35,8 @@ void ReverseGeoLookupThread::run()
QNetworkAccessManager *rgl = new QNetworkAccessManager();
QEventLoop loop;
QString mapquestURL("http://open.mapquestapi.com/nominatim/v1/reverse.php?format=json&accept-language=%1&lat=%2&lon=%3");
- QString geonamesURL("http://api.geonames.org/findNearbyPlaceNameJSON?language=%1&lat=%2&lng=%3&radius=50&username=dirkhh");
- QString geonamesOceanURL("http://api.geonames.org/oceanJSON?language=%1&lat=%2&lng=%3&radius=50&username=dirkhh");
+ QString geonamesURL("http://api.geonames.org/findNearbyPlaceNameJSON?lang=%1&lat=%2&lng=%3&radius=50&username=dirkhh");
+ QString geonamesOceanURL("http://api.geonames.org/oceanJSON?lang=%1&lat=%2&lng=%3&radius=50&username=dirkhh");
QString divelogsURL("https://www.divelogs.de/mapsearch_divespotnames.php?lat=%1&lng=%2&radius=50");
QTimer timer;
@@ -47,7 +47,7 @@ void ReverseGeoLookupThread::run()
struct dive_site *ds = &displayed_dive_site;
// first check the findNearbyPlaces API from geonames - that should give us country, state, city
- request.setUrl(geonamesURL.arg(uiLanguage(NULL)).arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0));
+ request.setUrl(geonamesURL.arg(uiLanguage(NULL).section(QRegExp("[-_ ]"), 0, 0)).arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0));
QNetworkReply *reply = rgl->get(request);
timer.setSingleShot(true);
@@ -124,7 +124,7 @@ void ReverseGeoLookupThread::run()
reply->abort();
}
// next check the oceans API to figure out the body of water
- request.setUrl(geonamesOceanURL.arg(uiLanguage(NULL)).arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0));
+ request.setUrl(geonamesOceanURL.arg(uiLanguage(NULL).section(QRegExp("[-_ ]"), 0, 0)).arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0));
reply = rgl->get(request);
connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
timer.start(5000); // 5 secs. timeout