QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
16 #ifndef QGSJSONUTILS_H
17 #define QGSJSONUTILS_H
19 #include "qgis_core.h"
26 #include <json_fwd.hpp>
27 using namespace nlohmann;
31 #include <QJsonObject>
212 QString exportFeature(
const QgsFeature &feature,
213 const QVariantMap &extraProperties = QVariantMap(),
214 const QVariant &
id = QVariant(),
215 int indent = -1 )
const;
226 json exportFeatureToJsonObject(
const QgsFeature &feature,
227 const QVariantMap &extraProperties = QVariantMap(),
228 const QVariant &
id = QVariant() ) const
SIP_SKIP;
238 QString exportFeatures( const
QgsFeatureList &features,
int indent = -1 ) const;
264 bool mIncludeGeometry = true;
267 bool mIncludeAttributes = true;
270 bool mIncludeRelatedAttributes = false;
279 bool mAttributeDisplayName = false;
281 bool mTransformGeometries = true;
312 static QgsFields stringToFields(
const QString &
string, QTextCodec *encoding =
nullptr );
320 static QString encodeValue(
const QVariant &value );
331 const QVector<QVariant> &attributeWidgetCaches = QVector<QVariant>() );
344 const QVector<QVariant> &attributeWidgetCaches = QVector<QVariant>() )
SIP_SKIP;
354 static QVariantList parseArray(
const QString &json, QVariant::Type type = QVariant::Invalid );
362 static json jsonFromVariant(
const QVariant &v )
SIP_SKIP;
369 static QVariant parseJson(
const std::string &jsonString )
SIP_SKIP;
376 static QVariant parseJson(
const QString &jsonString )
SIP_SKIP;
380 #endif // QGSJSONUTILS_H
bool includeAttributes() const
Returns whether attributes will be included in the JSON exports.
bool includeRelated() const
Returns whether attributes of related (child) features will be included in the JSON exports.
Helper utilities for working with JSON and GeoJSON conversions.
const QgsCoordinateReferenceSystem & crs
void setIncludeGeometry(bool includeGeometry)
Sets whether to include geometry in the JSON exports.
int precision() const
Returns the maximum number of decimal places to use in geometry coordinates.
QList< int > QgsAttributeList
void setExcludedAttributes(const QgsAttributeList &attributes)
Sets a list of attributes to specifically exclude from the JSON exports.
void setTransformGeometries(bool activate)
Sets whether geometries should be transformed in EPSG 4326 (default behavior) or just keep as it is.
void setIncludeAttributes(bool includeAttributes)
Sets whether to include attributes in the JSON exports.
void setAttributeDisplayName(bool displayName)
Sets whether to print original names of attributes or aliases if defined.
bool includeGeometry() const
Returns whether geometry will be included in the JSON exports.
void setPrecision(int precision)
Sets the maximum number of decimal places to use in geometry coordinates.
QList< QgsFeature > QgsFeatureList
Handles exporting QgsFeature features to GeoJSON features.
QgsAttributeList excludedAttributes() const
Returns a list of attributes which will be specifically excluded from the JSON exports.
QgsAttributeList attributes() const
Returns the list of attributes which will be included in the JSON exports, or an empty list if all at...
bool attributeDisplayName() const
Returns whether original names of attributes or aliases are printed.
void setIncludeRelated(bool includeRelated)
Sets whether to include attributes of features linked via references in the JSON exports.
void setAttributes(const QgsAttributeList &attributes)
Sets the list of attributes to include in the JSON exports.