diff options
-rw-r--r-- | src/location/doc/src/plugins/osm.qdoc | 15 | ||||
-rw-r--r-- | src/plugins/geoservices/osm/qplacemanagerengineosm.cpp | 7 | ||||
-rw-r--r-- | src/plugins/geoservices/osm/qplacemanagerengineosm.h | 1 |
3 files changed, 18 insertions, 5 deletions
diff --git a/src/location/doc/src/plugins/osm.qdoc b/src/location/doc/src/plugins/osm.qdoc index d5b23437..f6de9c20 100644 --- a/src/location/doc/src/plugins/osm.qdoc +++ b/src/location/doc/src/plugins/osm.qdoc @@ -72,13 +72,20 @@ a prefix. \row \li osm.routing.host \li Url string set when making network requests to the routing server. This parameter should be set to a - valid server url with the correct osrm api. If not specified the default \l {http://router.project-osrm.org/viaroute}{url} will be used. - \note The api documentation and sources are available at \l {http://project-osrm.org/}{Project OSRM}. + valid server url with the correct osrm API. If not specified the default \l {http://router.project-osrm.org/viaroute}{url} will be used. + \note The API documentation and sources are available at \l {http://project-osrm.org/}{Project OSRM}. \row \li osm.geocoding.host \li Url string set when making network requests to the geocoding server. This parameter should be set to a - valid server url with the correct osm api. If not specified the default \l {http://nominatim.openstreetmap.org/}{url} will be used. - \note The api documentation is available at \l {https://wiki.openstreetmap.org/wiki/Nominatim}{Project OSM Nominatim}. + valid server url with the correct osm API. If not specified the default \l {http://nominatim.openstreetmap.org/}{url} will be used. + \note The API documentation is available at \l {https://wiki.openstreetmap.org/wiki/Nominatim}{Project OSM Nominatim}. +\row + \li osm.places.host + \li Url string set when making network requests to the places server. + This parameter should be set to a valid server url with the correct osm API. + If not specified the default \l {http://nominatim.openstreetmap.org/search}{url} + will be used. + \note The API documentation is available at \l {https://wiki.openstreetmap.org/wiki/Nominatim}{Project OSM Nominatim}. \endtable \section1 Parameter Usage Example diff --git a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp index 2ae5bd7e..ed2c9ff0 100644 --- a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp +++ b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp @@ -97,6 +97,11 @@ QPlaceManagerEngineOsm::QPlaceManagerEngineOsm(const QVariantMap ¶meters, else m_userAgent = "Qt Location based application"; + if (parameters.contains(QStringLiteral("osm.places.host"))) + m_urlPrefix = parameters.value(QStringLiteral("osm.places.host")).toString(); + else + m_urlPrefix = QStringLiteral("http://nominatim.openstreetmap.org/search"); + *error = QGeoServiceProvider::NoError; errorString->clear(); } @@ -175,7 +180,7 @@ QPlaceSearchReply *QPlaceManagerEngineOsm::search(const QPlaceSearchRequest &req queryItems.addQueryItem(QStringLiteral("addressdetails"), QStringLiteral("1")); - QUrl requestUrl(QStringLiteral("http://nominatim.openstreetmap.org/search?")); + QUrl requestUrl(m_urlPrefix); requestUrl.setQuery(queryItems); QNetworkReply *networkReply = m_networkManager->get(QNetworkRequest(requestUrl)); diff --git a/src/plugins/geoservices/osm/qplacemanagerengineosm.h b/src/plugins/geoservices/osm/qplacemanagerengineosm.h index 9a15b493..828d7bf1 100644 --- a/src/plugins/geoservices/osm/qplacemanagerengineosm.h +++ b/src/plugins/geoservices/osm/qplacemanagerengineosm.h @@ -75,6 +75,7 @@ private: QNetworkAccessManager *m_networkManager; QByteArray m_userAgent; + QString m_urlPrefix; QList<QLocale> m_locales; QNetworkReply *m_categoriesReply; |