Commit 13cfc92d authored by Paolo Angelelli's avatar Paolo Angelelli
Browse files

Import OSM GeoJSON when extended data is requested


Make use of QGeoJSON and import the Nominatim-returned geojson
in geocode requests. Useful to get the shape of the geocode results.

[ChangeLog] GeoJSON returned in Nominatim
queries is now converted into the corresponding geoshapes using
QGeoJson.

Change-Id: Ie260e82d99363d55ed094e8dbf214d68c2ccadef
Fixes: QTBUG-74248
Reviewed-by: default avatarAndy Shaw <andy.shaw@qt.io>
Showing with 6 additions and 1 deletion
......@@ -46,6 +46,7 @@
#include <QtPositioning/QGeoAddress>
#include <QtPositioning/QGeoLocation>
#include <QtPositioning/QGeoRectangle>
#include <QtLocation/private/qgeojson_p.h>
QT_BEGIN_NAMESPACE
......@@ -112,8 +113,12 @@ static void injectExtra(QGeoLocation &location, const QJsonObject &object)
QStringLiteral("class") };
for (const auto k: extraKeys) {
if (object.contains(k))
if (object.contains(k)) {
extra[k] = object.value(k).toVariant();
if (k == QStringLiteral("geojson"))
extra[QStringLiteral("geojson_model")] =
QGeoJson::importGeoJson(QJsonDocument::fromVariant(extra[k]));
}
}
location.setExtendedAttributes(extra);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment