summaryrefslogtreecommitdiffstats
path: root/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp
diff options
context:
space:
mode:
authorWolfgang Bremer <wolfgang@w-bremer.de>2015-05-09 21:42:30 +0200
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-05-28 06:35:36 +0000
commit92d684aadda7f670643222b9cda4d368f2a82cb2 (patch)
treefa7d367463b956ef12ae04905a3be72b4c125249 /src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp
parenta5d615f5b49b29f91f979b4b338f7febbe445ebf (diff)
Allow custom URLs for OSM geocoding
This enables the usage of another geocoding server than the default osm project. The api still needs to be the same, but it is possible to use another server. Change-Id: I72f3835f28b9c52c042b23e9c4fdf2e85c752c56 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp')
-rw-r--r--src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp b/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp
index c9b0effd..3278939d 100644
--- a/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp
+++ b/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp
@@ -74,6 +74,11 @@ QGeoCodingManagerEngineOsm::QGeoCodingManagerEngineOsm(const QVariantMap &parame
else
m_userAgent = "Qt Location based application";
+ if (parameters.contains(QStringLiteral("osm.geocoding.host")))
+ m_urlPrefix = parameters.value(QStringLiteral("geocoding.host")).toString().toLatin1();
+ else
+ m_urlPrefix = QStringLiteral("http://nominatim.openstreetmap.org");
+
*error = QGeoServiceProvider::NoError;
errorString->clear();
}
@@ -94,7 +99,7 @@ QGeoCodeReply *QGeoCodingManagerEngineOsm::geocode(const QString &address, int l
QNetworkRequest request;
request.setRawHeader("User-Agent", m_userAgent);
- QUrl url(QStringLiteral("http://nominatim.openstreetmap.org/search"));
+ QUrl url(QString("%1/search").arg(m_urlPrefix));
QUrlQuery query;
query.addQueryItem(QStringLiteral("q"), address);
query.addQueryItem(QStringLiteral("format"), QStringLiteral("json"));
@@ -131,7 +136,7 @@ QGeoCodeReply *QGeoCodingManagerEngineOsm::reverseGeocode(const QGeoCoordinate &
QNetworkRequest request;
request.setRawHeader("User-Agent", m_userAgent);
- QUrl url(QStringLiteral("http://nominatim.openstreetmap.org/reverse"));
+ QUrl url(QString("%1/reverse").arg(m_urlPrefix));
QUrlQuery query;
query.addQueryItem(QStringLiteral("format"), QStringLiteral("json"));
query.addQueryItem(QStringLiteral("accept-language"), locale().name().left(2));