Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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.

Function Documentation

◆ exportGeoJson()

Q_LOCATION_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 1070 of file qgeojson.cpp.

References QList< T >::append(), exportFeature(), exportFeatureCollection(), exportGeometryCollection(), exportLineString(), exportMultiLineString(), exportMultiPoint(), exportMultiPolygon(), exportPoint(), exportPolygon(), i, QStringLiteral, QVariant::value(), QMap< Key, T >::value(), and QList< T >::value().

+ Here is the call graph for this function:

◆ importGeoJson()

Q_LOCATION_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 935 of file qgeojson.cpp.

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

Referenced by injectExtra(), and QDeclarativeGeoJsonData::openUrl().

+ 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 1110 of file qgeojson.cpp.

References QString::number().

+ Here is the call graph for this function:

◆ operator<<() [2/2]

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

Definition at line 1118 of file qgeojson.cpp.

References QGeoCircle::center, QGeoShape::CircleType, QString::number(), QGeoShape::PathType, 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 1150 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, QList< T >::size(), and QList< T >::toList().

Referenced by printQvariant(), and toString().

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

◆ toString()

Q_LOCATION_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 1215 of file qgeojson.cpp.

References printQvariant().

+ Here is the call graph for this function: