Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QGeoJson Namespace Reference

\inmodule QtLocation \keyword QGeoJson Namespace More...

Functions

QVariantList importGeoJson (const QJsonDocument &geoJson)
 This method imports the geoJson document, expected to contain valid GeoJSON data, into a QVariantList structured like described in the section \l {Importing GeoJSON}.
 
QJsonDocument exportGeoJson (const QVariantList &geoData)
 This method exports the QVariantList geoData, expected to be structured like described in the section \l {Importing GeoJSON}, to a QJsonDocument containing the data converted to GeoJSON.
 
QTextStreamoperator<< (QTextStream &stream, const QGeoCoordinate &crd)
 
QTextStreamoperator<< (QTextStream &stream, const QGeoShape &shape)
 
static QString printQvariant (const QVariant v, int tabs=0)
 
QString toString (const QVariantList &geoData)
 This method accepts the QVariantList geoData, structured as described in \l {Importing GeoJSON}, and returns a string containing the same data in a readable form.
 

Detailed Description

\inmodule QtLocation \keyword QGeoJson Namespace

The QGeoJson namespace contains functions to import and export geolocated information from and to GeoJson files.

Since
5.13

The methods in the QGeoJson namespace can be used to convert between a GeoJSON document (see the \l {https://en.wikipedia.org/wiki/GeoJSON} {Wikipedia page}, \l {https://tools.ietf.org/html/rfc7946} {RFC}) and a \l QVariantList of \l QVariantMap elements ready to be used as Model in a \l MapItemView.

Note
This private class is part of Qt labs, thus not stable API, it is part of the experimental components of QtLocation. Until it is promoted to public API, it may be subject to source and binary-breaking changes.

Function Documentation

◆ exportGeoJson()

Q_LOCATION_PRIVATE_EXPORT QJsonDocument QGeoJson::exportGeoJson ( const QVariantList geoData)

This method exports the QVariantList geoData, expected to be structured like described in the section \l {Importing GeoJSON}, to a QJsonDocument containing the data converted to GeoJSON.

Note
This method performs no validation on the input.
See also
importGeoJson

Definition at line 1074 of file qgeojson.cpp.

References QJsonArray::append(), QList< T >::at(), QMap< Key, T >::contains(), exportFeature(), exportFeatureCollection(), exportGeometryCollection(), exportLineString(), exportMultiLineString(), exportMultiPoint(), exportMultiPolygon(), exportPoint(), exportPolygon(), i, QList< T >::isEmpty(), QStringLiteral, QJsonDocument::setObject(), QList< T >::size(), QVariant::value(), and QMap< Key, T >::value().

+ Here is the call graph for this function:

◆ importGeoJson()

Q_LOCATION_PRIVATE_EXPORT QVariantList QGeoJson::importGeoJson ( const QJsonDocument geoJson)

This method imports the geoJson document, expected to contain valid GeoJSON data, into a QVariantList structured like described in the section \l {Importing GeoJSON}.

Note
This method performs no validation on the input.
See also
exportGeoJson

Definition at line 939 of file qgeojson.cpp.

References QList< T >::append(), QMap< Key, T >::contains(), QVariant::fromValue(), i, importFeatureCollection(), importGeometry(), importGeometryCollection(), importLineString(), importMultiLineString(), importMultiPoint(), importMultiPolygon(), importPoint(), importPolygon(), QMap< Key, T >::insert(), QVariant::isValid(), QJsonDocument::object(), QStringLiteral, QVariant::value(), and QMap< Key, T >::value().

Referenced by injectExtra().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<() [1/2]

QTextStream & QGeoJson::operator<< ( QTextStream stream,
const QGeoCoordinate crd 
)

Definition at line 1114 of file qgeojson.cpp.

References QGeoCoordinate::altitude, QGeoCoordinate::latitude, QGeoCoordinate::longitude, and QString::number().

+ Here is the call graph for this function:

◆ operator<<() [2/2]

QTextStream & QGeoJson::operator<< ( QTextStream stream,
const QGeoShape shape 
)

Definition at line 1122 of file qgeojson.cpp.

References QGeoCircle::center, QGeoShape::CircleType, QString::number(), QGeoShape::PathType, QGeoPolygon::perimeter, QGeoShape::PolygonType, QGeoCircle::radius, and QGeoShape::type.

+ Here is the call graph for this function:

◆ printQvariant()

static QString QGeoJson::printQvariant ( const QVariant  v,
int  tabs = 0 
)
static

Definition at line 1154 of file qgeojson.cpp.

References QList< T >::at(), QMap< Key, T >::begin(), QGeoShape::CircleType, QMap< Key, T >::contains(), QMap< Key, T >::end(), i, QList< T >::isEmpty(), iter, QMap< Key, T >::keys(), map, QGeoShape::PathType, QGeoShape::PolygonType, printQvariant(), QStringLiteral, QString::remove(), QList< T >::size(), QList< T >::toList(), and QGeoShape::type.

Referenced by printQvariant(), and toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toString()

Q_LOCATION_PRIVATE_EXPORT QString QGeoJson::toString ( const QVariantList geoData)

This method accepts the QVariantList geoData, structured as described in \l {Importing GeoJSON}, and returns a string containing the same data in a readable form.

Definition at line 1219 of file qgeojson.cpp.

References QList< T >::first(), QList< T >::isEmpty(), and printQvariant().

+ Here is the call graph for this function: