QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsvectorfilewriter.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorfilewriter.h
3  generic vector file writer
4  -------------------
5  begin : Jun 6 2004
6  copyright : (C) 2004 by Tim Sutton
7  email : tim at linfiniti.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSVECTORFILEWRITER_H
20 #define QGSVECTORFILEWRITER_H
21 
22 #include "qgis_core.h"
23 #include "qgis_sip.h"
24 #include "qgsfields.h"
25 #include "qgsfeedback.h"
26 #include "qgstaskmanager.h"
27 #include "qgsogrutils.h"
28 #include "qgsrenderer.h"
29 #include "qgsgeometryengine.h"
30 #include "qgsfeaturesink.h"
31 #include <ogr_api.h>
32 
33 class QgsSymbolLayer;
34 class QTextCodec;
35 class QgsFeatureIterator;
36 
46 class CORE_EXPORT QgsVectorFileWriter : public QgsFeatureSink
47 {
48  public:
50  {
51  Set,
53  Int,
54  Hidden
55  };
56 
60  class Option
61  {
62  public:
63  Option( const QString &docString, QgsVectorFileWriter::OptionType type )
64  : docString( docString )
65  , type( type ) {}
66  virtual ~Option() = default;
67 
68  QString docString;
70  };
71 
76  {
77  public:
78  SetOption( const QString &docString, const QStringList &values, const QString &defaultValue, bool allowNone = false )
79  : Option( docString, Set )
80  , values( qgis::listToSet( values ) )
81  , defaultValue( defaultValue )
82  , allowNone( allowNone )
83  {}
84 
85  QSet<QString> values;
86  QString defaultValue;
87  bool allowNone;
88  };
89 
94  {
95  public:
96  StringOption( const QString &docString, const QString &defaultValue = QString() )
97  : Option( docString, String )
98  , defaultValue( defaultValue )
99  {}
100 
101  QString defaultValue;
102  };
103 
108  {
109  public:
110  IntOption( const QString &docString, int defaultValue )
111  : Option( docString, Int )
112  , defaultValue( defaultValue )
113  {}
114 
116  };
117 
122  {
123  public:
124  BoolOption( const QString &docString, bool defaultValue )
125  : SetOption( docString, QStringList() << QStringLiteral( "YES" ) << QStringLiteral( "NO" ), defaultValue ? "YES" : "NO" )
126  {}
127  };
128 
133  {
134  public:
135  explicit HiddenOption( const QString &value )
136  : Option( QString(), Hidden )
137  , mValue( value )
138  {}
139 
140  QString mValue;
141  };
142 
143  struct MetaData
144  {
146  MetaData() = default;
147 
148  MetaData( const QString &longName, const QString &trLongName, const QString &glob, const QString &ext, const QMap<QString, QgsVectorFileWriter::Option *> &driverOptions, const QMap<QString, QgsVectorFileWriter::Option *> &layerOptions, const QString &compulsoryEncoding = QString() )
149  : longName( longName )
150  , trLongName( trLongName )
151  , glob( glob )
152  , ext( ext )
153  , driverOptions( driverOptions )
154  , layerOptions( layerOptions )
155  , compulsoryEncoding( compulsoryEncoding )
156  {}
157 
158  QString longName;
159  QString trLongName;
160  QString glob;
161  QString ext;
162  QMap<QString, QgsVectorFileWriter::Option *> driverOptions;
163  QMap<QString, QgsVectorFileWriter::Option *> layerOptions;
166  };
167 
169  {
170  NoError = 0,
181  };
182 
184  {
185  NoSymbology = 0, //export only data
186  FeatureSymbology, //Keeps the number of features and export symbology per feature
187  SymbolLayerSymbology //Exports one feature per symbol layer (considering symbol levels)
188  };
189 
196  {
197  Original = 0,
199  };
200 
206  {
207  SortRecommended = 1 << 1,
208  SkipNonSpatialFormats = 1 << 2,
209  };
210  Q_DECLARE_FLAGS( VectorFormatOptions, VectorFormatOption )
211 
212 
217  class CORE_EXPORT FieldValueConverter
218  {
219  public:
221  FieldValueConverter() = default;
222 
223  virtual ~FieldValueConverter() = default;
224 
230  virtual QgsField fieldDefinition( const QgsField &field );
231 
238  virtual QVariant convert( int fieldIdxInLayer, const QVariant &value );
239 
244  };
245 
251  {
253  CanAddNewLayer = 1 << 0,
254 
256  CanAppendToExistingLayer = 1 << 1,
257 
259  CanAddNewFieldsToExistingLayer = 1 << 2,
260 
262  CanDeleteLayer = 1 << 3
263  };
264 
269  Q_DECLARE_FLAGS( EditionCapabilities, EditionCapability )
270 
271 
276  {
279 
282 
285 
287  AppendToLayerAddFields
288  };
289 
290 #ifndef SIP_RUN
291 
317 #else
318 
343 #endif
344  Q_DECL_DEPRECATED static QgsVectorFileWriter::WriterError writeAsVectorFormat( QgsVectorLayer *layer,
345  const QString &fileName,
346  const QString &fileEncoding,
348  const QString &driverName = "GPKG",
349  bool onlySelected = false,
350  QString *errorMessage SIP_OUT = nullptr,
351  const QStringList &datasourceOptions = QStringList(),
352  const QStringList &layerOptions = QStringList(),
353  bool skipAttributeCreation = false,
354  QString *newFilename = nullptr,
356  double symbologyScale = 1.0,
357  const QgsRectangle *filterExtent = nullptr,
358  QgsWkbTypes::Type overrideGeometryType = QgsWkbTypes::Unknown,
359  bool forceMulti = false,
360  bool includeZ = false,
361  const QgsAttributeList &attributes = QgsAttributeList(),
362  QgsVectorFileWriter::FieldValueConverter *fieldValueConverter = nullptr
363 #ifndef SIP_RUN
364  , QString *newLayer = nullptr );
365 #else
366  ) SIP_DEPRECATED;
367 #endif
368 
369 #ifndef SIP_RUN
370 
398 #else
399 
426 #endif
427  Q_DECL_DEPRECATED static QgsVectorFileWriter::WriterError writeAsVectorFormat( QgsVectorLayer *layer,
428  const QString &fileName,
429  const QString &fileEncoding,
430  const QgsCoordinateTransform &ct,
431  const QString &driverName = "GPKG",
432  bool onlySelected = false,
433  QString *errorMessage SIP_OUT = nullptr,
434  const QStringList &datasourceOptions = QStringList(),
435  const QStringList &layerOptions = QStringList(),
436  bool skipAttributeCreation = false,
437  QString *newFilename = nullptr,
439  double symbologyScale = 1.0,
440  const QgsRectangle *filterExtent = nullptr,
441  QgsWkbTypes::Type overrideGeometryType = QgsWkbTypes::Unknown,
442  bool forceMulti = false,
443  bool includeZ = false,
444  const QgsAttributeList &attributes = QgsAttributeList(),
445  QgsVectorFileWriter::FieldValueConverter *fieldValueConverter = nullptr
446 #ifndef SIP_RUN
447  , QString *newLayer = nullptr );
448 #else
449  ) SIP_DEPRECATED;
450 #endif
451 
457  class CORE_EXPORT SaveVectorOptions
458  {
459  public:
462 
463  virtual ~SaveVectorOptions() = default;
464 
466  QString driverName;
467 
469  QString layerName;
470 
472  QgsVectorFileWriter::ActionOnExistingFile actionOnExistingFile = CreateOrOverwriteFile;
473 
475  QString fileEncoding;
476 
482 
484  bool onlySelectedFeatures = false;
485 
487  QStringList datasourceOptions;
488 
490  QStringList layerOptions;
491 
493  bool skipAttributeCreation = false;
494 
497 
499  QgsVectorFileWriter::SymbologyExport symbologyExport = NoSymbology;
500 
502  double symbologyScale = 1.0;
503 
506 
511  QgsWkbTypes::Type overrideGeometryType = QgsWkbTypes::Unknown;
512 
514  bool forceMulti = false;
515 
517  bool includeZ = false;
518 
525  QgsVectorFileWriter::FieldValueConverter *fieldValueConverter = nullptr;
526 
528  QgsFeedback *feedback = nullptr;
529 
535  FieldNameSource fieldNameSource = Original;
536 
543  bool saveMetadata = false;
544 
552  };
553 
554 #ifndef SIP_RUN
555 
567 #else
568 
579 #endif
580  Q_DECL_DEPRECATED static QgsVectorFileWriter::WriterError writeAsVectorFormat( QgsVectorLayer *layer,
581  const QString &fileName,
583  QString *newFilename = nullptr,
584  QString *errorMessage SIP_OUT = nullptr
585 #ifndef SIP_RUN
586  , QString *newLayer = nullptr );
587 #else
588  ) SIP_DEPRECATED;
589 #endif
590 
595  Q_DECL_DEPRECATED QgsVectorFileWriter( const QString &vectorFileName,
596  const QString &fileEncoding,
597  const QgsFields &fields,
598  QgsWkbTypes::Type geometryType,
600  const QString &driverName = "GPKG",
601  const QStringList &datasourceOptions = QStringList(),
602  const QStringList &layerOptions = QStringList(),
603  QString *newFilename = nullptr,
605  QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags()
606 #ifndef SIP_RUN
607  , QString *newLayer = nullptr,
609  FieldNameSource fieldNameSource = Original
610 #endif
611  ) SIP_DEPRECATED;
612 
635  Q_DECL_DEPRECATED QgsVectorFileWriter( const QString &vectorFileName,
636  const QString &fileEncoding,
637  const QgsFields &fields,
638  QgsWkbTypes::Type geometryType,
639  const QgsCoordinateReferenceSystem &srs,
640  const QString &driverName,
641  const QStringList &datasourceOptions,
642  const QStringList &layerOptions,
643  QString *newFilename,
644  QgsVectorFileWriter::SymbologyExport symbologyExport,
645  QgsVectorFileWriter::FieldValueConverter *fieldValueConverter,
646  const QString &layerName,
648  QString *newLayer = nullptr,
650  QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(),
651  FieldNameSource fieldNameSource = Original
652  ) SIP_SKIP;
653 
658 
672  static QgsVectorFileWriter *create( const QString &fileName,
673  const QgsFields &fields,
674  QgsWkbTypes::Type geometryType,
675  const QgsCoordinateReferenceSystem &srs,
676  const QgsCoordinateTransformContext &transformContext,
678  QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(),
679  QString *newFilename = nullptr,
680  QString *newLayer = nullptr ) SIP_FACTORY;
681 
694  Q_DECL_DEPRECATED static QgsVectorFileWriter::WriterError writeAsVectorFormatV2( QgsVectorLayer *layer,
695  const QString &fileName,
696  const QgsCoordinateTransformContext &transformContext,
697  const QgsVectorFileWriter::SaveVectorOptions &options,
698  QString *newFilename = nullptr,
699  QString *newLayer = nullptr,
700  QString *errorMessage SIP_OUT = nullptr ) SIP_DEPRECATED;
701 
714  static QgsVectorFileWriter::WriterError writeAsVectorFormatV3( QgsVectorLayer *layer,
715  const QString &fileName,
716  const QgsCoordinateTransformContext &transformContext,
717  const QgsVectorFileWriter::SaveVectorOptions &options,
718  QString *errorMessage SIP_OUT = nullptr,
719  QString *newFilename SIP_OUT = nullptr,
720  QString *newLayer SIP_OUT = nullptr );
721 
727  {
729  QString driverName;
730 
732  QString filterString;
733 
738  QStringList globs;
739  };
740 
749  static QList< QgsVectorFileWriter::FilterFormatDetails > supportedFiltersAndFormats( VectorFormatOptions options = SortRecommended );
750 
760  static QStringList supportedFormatExtensions( VectorFormatOptions options = SortRecommended );
761 
769  static bool supportsFeatureStyles( const QString &driverName );
770 
776  {
778  QString longName;
779 
781  QString driverName;
782  };
783 
795  static QList< QgsVectorFileWriter::DriverDetails > ogrDriverList( VectorFormatOptions options = SortRecommended );
796 
803  static QString driverForExtension( const QString &extension );
804 
811  static QString fileFilterString( VectorFormatOptions options = SortRecommended );
812 
814  static QString filterForDriver( const QString &driverName );
815 
817  static QString convertCodecNameForEncodingOption( const QString &codecName );
818 
821 
823  QString errorMessage();
824 
825  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) override;
826  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) override;
827  QString lastError() const override;
828 
833  bool addFeatureWithStyle( QgsFeature &feature, QgsFeatureRenderer *renderer, QgsUnitTypes::DistanceUnit outputUnit = QgsUnitTypes::DistanceMeters );
834 
836  QMap<int, int> attrIdxToOgrIdx() { return mAttrIdxToOgrIdx; } SIP_SKIP
837 
839  ~QgsVectorFileWriter() override;
840 
846  static bool deleteShapeFile( const QString &fileName );
847 
848  QgsVectorFileWriter::SymbologyExport symbologyExport() const { return mSymbologyExport; }
849  void setSymbologyExport( QgsVectorFileWriter::SymbologyExport symExport ) { mSymbologyExport = symExport; }
850 
857  double symbologyScale() const { return mSymbologyScale; }
858 
865  void setSymbologyScale( double scale );
866 
867  static bool driverMetadata( const QString &driverName, MetaData &driverMetadata );
868 
875  static QStringList defaultDatasetOptions( const QString &driverName );
876 
883  static QStringList defaultLayerOptions( const QString &driverName );
884 
891  static OGRwkbGeometryType ogrTypeFromWkbType( QgsWkbTypes::Type type ) SIP_SKIP;
892 
897  static QgsVectorFileWriter::EditionCapabilities editionCapabilities( const QString &datasetName );
898 
903  static bool targetLayerExists( const QString &datasetName,
904  const QString &layerName );
905 
910  static bool areThereNewFieldsToCreate( const QString &datasetName,
911  const QString &layerName,
912  QgsVectorLayer *layer,
913  const QgsAttributeList &attributes );
914 
915  protected:
917  OGRGeometryH createEmptyGeometry( QgsWkbTypes::Type wkbType ) SIP_SKIP;
918 
920  OGRLayerH mLayer = nullptr;
921  OGRSpatialReferenceH mOgrRef = nullptr;
922 
924 
927  QString mErrorMessage;
928 
929  QTextCodec *mCodec = nullptr;
930 
933 
935  QMap<int, int> mAttrIdxToOgrIdx;
936 
938 
939  QMap< QgsSymbolLayer *, QString > mSymbolLayerTable;
940 
943 
944  QString mOgrDriverName;
945 
947  FieldValueConverter *mFieldValueConverter = nullptr;
948 
949  private:
950 #ifdef SIP_RUN
952 #endif
953 
954  struct PreparedWriterDetails
955  {
956  std::unique_ptr< QgsFeatureRenderer > renderer;
958  QgsWkbTypes::Type sourceWkbType = QgsWkbTypes::Unknown;
959  QgsFields sourceFields;
960  QString providerType;
961  long long featureCount = 0;
962  QgsFeatureIds selectedFeatureIds;
963  QString dataSourceUri;
964  QString storageType;
965  QgsFeatureIterator geometryTypeScanIterator;
966  QgsExpressionContext expressionContext;
967  QSet< int > fieldsToConvertToInt;
968  QgsRenderContext renderContext;
969  bool shallTransform = false;
972  QgsAttributeList attributes;
973  QgsFields outputFields;
974  QgsFeatureIterator sourceFeatureIterator;
975  QgsGeometry filterRectGeometry;
976  std::unique_ptr< QgsGeometryEngine > filterRectEngine;
977  QVariantMap providerUriParams;
978  };
979 
984  static QgsVectorFileWriter::WriterError prepareWriteAsVectorFormat( QgsVectorLayer *layer,
986  PreparedWriterDetails &details );
987 
1001  static QgsVectorFileWriter::WriterError writeAsVectorFormatV2( PreparedWriterDetails &details,
1002  const QString &fileName,
1003  const QgsCoordinateTransformContext &transformContext,
1005  QString *newFilename = nullptr,
1006  QString *newLayer = nullptr,
1007  QString *errorMessage SIP_OUT = nullptr );
1008 
1014  Q_DECL_DEPRECATED static QgsVectorFileWriter::WriterError writeAsVectorFormat( PreparedWriterDetails &details,
1015  const QString &fileName,
1017  QString *newFilename = nullptr,
1018  QString *errorMessage SIP_OUT = nullptr,
1019  QString *newLayer = nullptr ) SIP_DEPRECATED;
1020 
1021  void init( QString vectorFileName, QString fileEncoding, const QgsFields &fields,
1022  QgsWkbTypes::Type geometryType, QgsCoordinateReferenceSystem srs,
1023  const QString &driverName, QStringList datasourceOptions,
1024  QStringList layerOptions, QString *newFilename,
1025  QgsVectorFileWriter::FieldValueConverter *fieldValueConverter,
1026  const QString &layerName,
1027  QgsVectorFileWriter::ActionOnExistingFile action, QString *newLayer, QgsFeatureSink::SinkFlags sinkFlags,
1028  const QgsCoordinateTransformContext &transformContext,
1029  FieldNameSource fieldNameSource );
1030  void resetMap( const QgsAttributeList &attributes );
1031 
1032  std::unique_ptr< QgsFeatureRenderer > mRenderer;
1033  QgsRenderContext mRenderContext;
1034 
1035 
1036  std::unique_ptr< QgsCoordinateTransform > mCoordinateTransform;
1037 
1038  bool mUsingTransaction = false;
1039  QSet< QVariant::Type > mSupportedListSubTypes;
1040 
1041  void createSymbolLayerTable( QgsVectorLayer *vl, const QgsCoordinateTransform &ct, OGRDataSourceH ds );
1042  gdal::ogr_feature_unique_ptr createFeature( const QgsFeature &feature );
1043  bool writeFeature( OGRLayerH layer, OGRFeatureH feature );
1044 
1046  QgsVectorFileWriter::WriterError exportFeaturesSymbolLevels( const PreparedWriterDetails &details, QgsFeatureIterator &fit, const QgsCoordinateTransform &ct, QString *errorMessage = nullptr );
1047  double mmScaleFactor( double scale, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits );
1048  double mapUnitScaleFactor( double scale, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits );
1049 
1050  void startRender( QgsFeatureRenderer *sourceRenderer, const QgsFields &fields );
1051  void stopRender();
1052  std::unique_ptr< QgsFeatureRenderer > createSymbologyRenderer( QgsFeatureRenderer *sourceRenderer ) const;
1054  static void addRendererAttributes( QgsFeatureRenderer *renderer, QgsRenderContext &context, const QgsFields &fields, QgsAttributeList &attList );
1055 
1057  static QStringList concatenateOptions( const QMap<QString, Option *> &options );
1058 
1060  friend class TestQgsVectorFileWriter;
1061 };
1062 
1063 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsVectorFileWriter::EditionCapabilities )
1064 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsVectorFileWriter::VectorFormatOptions )
1065 
1066 // clazy:excludeall=qstring-allocations
1067 
1068 #endif
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Class for doing transforms between two map coordinate systems.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Wrapper for iterator of features from vector data provider or vector layer.
An interface for objects which accept features via addFeature(s) methods.
virtual bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
Adds a single feature to the sink.
virtual QString lastError() const
Returns the most recent error encountered by the sink, e.g.
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
Adds a list of features to the sink.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:51
Container of fields for a vector layer.
Definition: qgsfields.h:45
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
A structured metadata store for a map layer.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Contains information about the context of a rendering operation.
Helper functions for various unit types.
Definition: qgsunittypes.h:39
DistanceUnit
Units of distance.
Definition: qgsunittypes.h:68
@ DistanceMeters
Meters.
Definition: qgsunittypes.h:69
QgsTask task which performs a QgsVectorFileWriter layer saving operation as a background task.
BoolOption(const QString &docString, bool defaultValue)
Interface to convert raw field values to their user-friendly value.
FieldValueConverter()=default
Constructor.
IntOption(const QString &docString, int defaultValue)
Option(const QString &docString, QgsVectorFileWriter::OptionType type)
QgsVectorFileWriter::OptionType type
virtual ~Option()=default
Options to pass to writeAsVectorFormat()
QgsCoordinateTransform ct
Transform to reproject exported geometries with, or invalid transform for no transformation.
QgsLayerMetadata layerMetadata
Layer metadata to save for the exported vector file.
QString layerName
Layer name. If let empty, it will be derived from the filename.
QgsRectangle filterExtent
If not empty, only features intersecting the extent will be saved.
QStringList layerOptions
List of OGR layer creation options.
QgsAttributeList attributes
Attributes to export (empty means all unless skipAttributeCreation is set)
QStringList datasourceOptions
List of OGR data source creation options.
SetOption(const QString &docString, const QStringList &values, const QString &defaultValue, bool allowNone=false)
StringOption(const QString &docString, const QString &defaultValue=QString())
A convenience class for writing vector layers to disk based formats (e.g.
EditionCapability
Edition capability flags.
double mSymbologyScale
Scale for symbology export (e.g. for symbols units in map units)
QMap< int, int > mAttrIdxToOgrIdx
Map attribute indizes to OGR field indexes.
@ Canceled
Writing was interrupted by manual cancellation.
@ ErrSavingMetadata
Metadata saving failed.
gdal::ogr_datasource_unique_ptr mDS
QgsVectorFileWriter(const QgsVectorFileWriter &rh)=delete
QgsVectorFileWriter cannot be copied.
double symbologyScale() const
Returns the reference scale for output.
SymbologyExport mSymbologyExport
QgsWkbTypes::Type mWkbType
Geometry type which is being used.
VectorFormatOption
Options for sorting and filtering vector formats.
void setSymbologyExport(QgsVectorFileWriter::SymbologyExport symExport)
QMap< int, int > attrIdxToOgrIdx()
QgsVectorFileWriter & operator=(const QgsVectorFileWriter &rh)=delete
QgsVectorFileWriter cannot be copied.
WriterError mError
Contains error value if construction was not successful.
FieldNameSource
Source for exported field names.
@ PreferAlias
Use the field alias as the exported field name, wherever one is set. Otherwise use the original field...
QgsVectorFileWriter::SymbologyExport symbologyExport() const
QMap< QgsSymbolLayer *, QString > mSymbolLayerTable
ActionOnExistingFile
Combination of CanAddNewLayer, CanAppendToExistingLayer, CanAddNewFieldsToExistingLayer or CanDeleteL...
@ CreateOrOverwriteLayer
Create or overwrite layer.
@ CreateOrOverwriteFile
Create or overwrite file.
@ AppendToLayerNoNewFields
Append features to existing layer, but do not create new fields.
Represents a vector layer which manages a vector based data sets.
Handles storage of information regarding WKB types and their properties.
Definition: qgswkbtypes.h:42
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:70
std::unique_ptr< std::remove_pointer< OGRFeatureH >::type, OGRFeatureDeleter > ogr_feature_unique_ptr
Scoped OGR feature.
Definition: qgsogrutils.h:131
std::unique_ptr< std::remove_pointer< OGRDataSourceH >::type, OGRDataSourceDeleter > ogr_datasource_unique_ptr
Scoped OGR data source.
Definition: qgsogrutils.h:116
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:79
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_OUT
Definition: qgis_sip.h:58
#define SIP_FACTORY
Definition: qgis_sip.h:76
void * OGRSpatialReferenceH
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:736
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:37
QList< int > QgsAttributeList
Definition: qgsfield.h:26
const QgsField & field
Definition: qgsfield.h:463
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
const QgsCoordinateReferenceSystem & outputCrs
Details of available driver formats.
QString longName
Descriptive, user friendly name for the driver.
QString driverName
Unique driver name.
Details of available filters and formats.
QString filterString
Filter string for file picker dialogs.
QStringList globs
Matching glob patterns for format, e.g.
MetaData(const QString &longName, const QString &trLongName, const QString &glob, const QString &ext, const QMap< QString, QgsVectorFileWriter::Option * > &driverOptions, const QMap< QString, QgsVectorFileWriter::Option * > &layerOptions, const QString &compulsoryEncoding=QString())
MetaData()=default
Constructor for MetaData.
QMap< QString, QgsVectorFileWriter::Option * > driverOptions
QMap< QString, QgsVectorFileWriter::Option * > layerOptions
QString compulsoryEncoding
Some formats require a compulsory encoding, typically UTF-8. If no compulsory encoding,...