QGIS API Documentation  3.27.0-Master (e113457133)
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 "qgsrendercontext.h"
32 #include <ogr_api.h>
33 
34 class QgsSymbolLayer;
35 class QTextCodec;
36 class QgsFeatureIterator;
37 
47 class CORE_EXPORT QgsVectorFileWriter : public QgsFeatureSink
48 {
49  public:
51  {
52  Set,
54  Int,
55  Hidden
56  };
57 
61  class Option
62  {
63  public:
64  Option( const QString &docString, QgsVectorFileWriter::OptionType type )
65  : docString( docString )
66  , type( type ) {}
67  virtual ~Option() = default;
68 
69  QString docString;
71  };
72 
77  {
78  public:
79  SetOption( const QString &docString, const QStringList &values, const QString &defaultValue, bool allowNone = false )
80  : Option( docString, Set )
81  , values( qgis::listToSet( values ) )
82  , defaultValue( defaultValue )
83  , allowNone( allowNone )
84  {}
85 
86  QSet<QString> values;
87  QString defaultValue;
88  bool allowNone;
89  };
90 
95  {
96  public:
97  StringOption( const QString &docString, const QString &defaultValue = QString() )
98  : Option( docString, String )
99  , defaultValue( defaultValue )
100  {}
101 
102  QString defaultValue;
103  };
104 
109  {
110  public:
111  IntOption( const QString &docString, int defaultValue )
112  : Option( docString, Int )
113  , defaultValue( defaultValue )
114  {}
115 
117  };
118 
123  {
124  public:
125  BoolOption( const QString &docString, bool defaultValue )
126  : SetOption( docString, QStringList() << QStringLiteral( "YES" ) << QStringLiteral( "NO" ), defaultValue ? "YES" : "NO" )
127  {}
128  };
129 
134  {
135  public:
136  explicit HiddenOption( const QString &value )
137  : Option( QString(), Hidden )
138  , mValue( value )
139  {}
140 
141  QString mValue;
142  };
143 
144  struct MetaData
145  {
147  MetaData() = default;
148 
149  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() )
150  : longName( longName )
151  , trLongName( trLongName )
152  , glob( glob )
153  , ext( ext )
154  , driverOptions( driverOptions )
155  , layerOptions( layerOptions )
156  , compulsoryEncoding( compulsoryEncoding )
157  {}
158 
159  QString longName;
160  QString trLongName;
161  QString glob;
162  QString ext;
163  QMap<QString, QgsVectorFileWriter::Option *> driverOptions;
164  QMap<QString, QgsVectorFileWriter::Option *> layerOptions;
167  };
168 
170  {
171  NoError = 0,
182  };
183 
185  {
186  NoSymbology = 0, //export only data
187  FeatureSymbology, //Keeps the number of features and export symbology per feature
188  SymbolLayerSymbology //Exports one feature per symbol layer (considering symbol levels)
189  };
190 
197  {
198  Original = 0,
200  };
201 
207  {
208  SortRecommended = 1 << 1,
209  SkipNonSpatialFormats = 1 << 2,
210  };
211  Q_DECLARE_FLAGS( VectorFormatOptions, VectorFormatOption )
212 
213 
218  class CORE_EXPORT FieldValueConverter
219  {
220  public:
222  FieldValueConverter() = default;
223 
224  virtual ~FieldValueConverter() = default;
225 
231  virtual QgsField fieldDefinition( const QgsField &field );
232 
239  virtual QVariant convert( int fieldIdxInLayer, const QVariant &value );
240 
245  };
246 
252  {
254  CanAddNewLayer = 1 << 0,
255 
257  CanAppendToExistingLayer = 1 << 1,
258 
260  CanAddNewFieldsToExistingLayer = 1 << 2,
261 
263  CanDeleteLayer = 1 << 3
264  };
265 
270  Q_DECLARE_FLAGS( EditionCapabilities, EditionCapability )
271 
272 
277  {
280 
283 
286 
288  AppendToLayerAddFields
289  };
290 
291 #ifndef SIP_RUN
292 
318 #else
319 
344 #endif
345  Q_DECL_DEPRECATED static QgsVectorFileWriter::WriterError writeAsVectorFormat( QgsVectorLayer *layer,
346  const QString &fileName,
347  const QString &fileEncoding,
349  const QString &driverName = "GPKG",
350  bool onlySelected = false,
351  QString *errorMessage SIP_OUT = nullptr,
352  const QStringList &datasourceOptions = QStringList(),
353  const QStringList &layerOptions = QStringList(),
354  bool skipAttributeCreation = false,
355  QString *newFilename = nullptr,
357  double symbologyScale = 1.0,
358  const QgsRectangle *filterExtent = nullptr,
359  QgsWkbTypes::Type overrideGeometryType = QgsWkbTypes::Unknown,
360  bool forceMulti = false,
361  bool includeZ = false,
362  const QgsAttributeList &attributes = QgsAttributeList(),
363  QgsVectorFileWriter::FieldValueConverter *fieldValueConverter = nullptr
364 #ifndef SIP_RUN
365  , QString *newLayer = nullptr );
366 #else
367  ) SIP_DEPRECATED;
368 #endif
369 
370 #ifndef SIP_RUN
371 
399 #else
400 
427 #endif
428  Q_DECL_DEPRECATED static QgsVectorFileWriter::WriterError writeAsVectorFormat( QgsVectorLayer *layer,
429  const QString &fileName,
430  const QString &fileEncoding,
431  const QgsCoordinateTransform &ct,
432  const QString &driverName = "GPKG",
433  bool onlySelected = false,
434  QString *errorMessage SIP_OUT = nullptr,
435  const QStringList &datasourceOptions = QStringList(),
436  const QStringList &layerOptions = QStringList(),
437  bool skipAttributeCreation = false,
438  QString *newFilename = nullptr,
440  double symbologyScale = 1.0,
441  const QgsRectangle *filterExtent = nullptr,
442  QgsWkbTypes::Type overrideGeometryType = QgsWkbTypes::Unknown,
443  bool forceMulti = false,
444  bool includeZ = false,
445  const QgsAttributeList &attributes = QgsAttributeList(),
446  QgsVectorFileWriter::FieldValueConverter *fieldValueConverter = nullptr
447 #ifndef SIP_RUN
448  , QString *newLayer = nullptr );
449 #else
450  ) SIP_DEPRECATED;
451 #endif
452 
458  class CORE_EXPORT SaveVectorOptions
459  {
460  public:
463 
464  virtual ~SaveVectorOptions() = default;
465 
467  QString driverName;
468 
470  QString layerName;
471 
473  QgsVectorFileWriter::ActionOnExistingFile actionOnExistingFile = CreateOrOverwriteFile;
474 
476  QString fileEncoding;
477 
483 
485  bool onlySelectedFeatures = false;
486 
488  QStringList datasourceOptions;
489 
491  QStringList layerOptions;
492 
494  bool skipAttributeCreation = false;
495 
498 
501 
503  QgsVectorFileWriter::SymbologyExport symbologyExport = NoSymbology;
504 
506  double symbologyScale = 1.0;
507 
510 
515  QgsWkbTypes::Type overrideGeometryType = QgsWkbTypes::Unknown;
516 
518  bool forceMulti = false;
519 
521  bool includeZ = false;
522 
529  QgsVectorFileWriter::FieldValueConverter *fieldValueConverter = nullptr;
530 
532  QgsFeedback *feedback = nullptr;
533 
539  FieldNameSource fieldNameSource = Original;
540 
547  bool saveMetadata = false;
548 
556  };
557 
558 #ifndef SIP_RUN
559 
571 #else
572 
583 #endif
584  Q_DECL_DEPRECATED static QgsVectorFileWriter::WriterError writeAsVectorFormat( QgsVectorLayer *layer,
585  const QString &fileName,
587  QString *newFilename = nullptr,
588  QString *errorMessage SIP_OUT = nullptr
589 #ifndef SIP_RUN
590  , QString *newLayer = nullptr );
591 #else
592  ) SIP_DEPRECATED;
593 #endif
594 
599  Q_DECL_DEPRECATED QgsVectorFileWriter( const QString &vectorFileName,
600  const QString &fileEncoding,
601  const QgsFields &fields,
602  QgsWkbTypes::Type geometryType,
604  const QString &driverName = "GPKG",
605  const QStringList &datasourceOptions = QStringList(),
606  const QStringList &layerOptions = QStringList(),
607  QString *newFilename = nullptr,
609  QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags()
610 #ifndef SIP_RUN
611  , QString *newLayer = nullptr,
613  FieldNameSource fieldNameSource = Original
614 #endif
615  ) SIP_DEPRECATED;
616 
639  Q_DECL_DEPRECATED QgsVectorFileWriter( const QString &vectorFileName,
640  const QString &fileEncoding,
641  const QgsFields &fields,
642  QgsWkbTypes::Type geometryType,
643  const QgsCoordinateReferenceSystem &srs,
644  const QString &driverName,
645  const QStringList &datasourceOptions,
646  const QStringList &layerOptions,
647  QString *newFilename,
648  QgsVectorFileWriter::SymbologyExport symbologyExport,
649  QgsVectorFileWriter::FieldValueConverter *fieldValueConverter,
650  const QString &layerName,
652  QString *newLayer = nullptr,
654  QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(),
655  FieldNameSource fieldNameSource = Original
656  ) SIP_SKIP;
657 
662 
676  static QgsVectorFileWriter *create( const QString &fileName,
677  const QgsFields &fields,
678  QgsWkbTypes::Type geometryType,
679  const QgsCoordinateReferenceSystem &srs,
680  const QgsCoordinateTransformContext &transformContext,
682  QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(),
683  QString *newFilename = nullptr,
684  QString *newLayer = nullptr ) SIP_FACTORY;
685 
698  Q_DECL_DEPRECATED static QgsVectorFileWriter::WriterError writeAsVectorFormatV2( QgsVectorLayer *layer,
699  const QString &fileName,
700  const QgsCoordinateTransformContext &transformContext,
701  const QgsVectorFileWriter::SaveVectorOptions &options,
702  QString *newFilename = nullptr,
703  QString *newLayer = nullptr,
704  QString *errorMessage SIP_OUT = nullptr ) SIP_DEPRECATED;
705 
718  static QgsVectorFileWriter::WriterError writeAsVectorFormatV3( QgsVectorLayer *layer,
719  const QString &fileName,
720  const QgsCoordinateTransformContext &transformContext,
721  const QgsVectorFileWriter::SaveVectorOptions &options,
722  QString *errorMessage SIP_OUT = nullptr,
723  QString *newFilename SIP_OUT = nullptr,
724  QString *newLayer SIP_OUT = nullptr );
725 
731  {
733  QString driverName;
734 
736  QString filterString;
737 
742  QStringList globs;
743  };
744 
753  static QList< QgsVectorFileWriter::FilterFormatDetails > supportedFiltersAndFormats( VectorFormatOptions options = SortRecommended );
754 
764  static QStringList supportedFormatExtensions( VectorFormatOptions options = SortRecommended );
765 
773  static bool supportsFeatureStyles( const QString &driverName );
774 
780  {
782  QString longName;
783 
785  QString driverName;
786  };
787 
799  static QList< QgsVectorFileWriter::DriverDetails > ogrDriverList( VectorFormatOptions options = SortRecommended );
800 
807  static QString driverForExtension( const QString &extension );
808 
815  static QString fileFilterString( VectorFormatOptions options = SortRecommended );
816 
818  static QString filterForDriver( const QString &driverName );
819 
821  static QString convertCodecNameForEncodingOption( const QString &codecName );
822 
824  QgsVectorFileWriter::WriterError hasError() const;
825 
827  QString errorMessage() const;
828 
829  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) override;
830  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) override;
831  QString lastError() const override;
832 
837  bool addFeatureWithStyle( QgsFeature &feature, QgsFeatureRenderer *renderer, QgsUnitTypes::DistanceUnit outputUnit = QgsUnitTypes::DistanceMeters );
838 
840  QMap<int, int> attrIdxToOgrIdx() const { return mAttrIdxToOgrIdx; } SIP_SKIP
841 
843  ~QgsVectorFileWriter() override;
844 
850  static bool deleteShapeFile( const QString &fileName );
851 
852  QgsVectorFileWriter::SymbologyExport symbologyExport() const { return mSymbologyExport; }
853  void setSymbologyExport( QgsVectorFileWriter::SymbologyExport symExport ) { mSymbologyExport = symExport; }
854 
861  double symbologyScale() const { return mSymbologyScale; }
862 
869  void setSymbologyScale( double scale );
870 
871  static bool driverMetadata( const QString &driverName, MetaData &driverMetadata );
872 
879  static QStringList defaultDatasetOptions( const QString &driverName );
880 
887  static QStringList defaultLayerOptions( const QString &driverName );
888 
895  static OGRwkbGeometryType ogrTypeFromWkbType( QgsWkbTypes::Type type ) SIP_SKIP;
896 
901  static QgsVectorFileWriter::EditionCapabilities editionCapabilities( const QString &datasetName );
902 
907  static bool targetLayerExists( const QString &datasetName,
908  const QString &layerName );
909 
914  static bool areThereNewFieldsToCreate( const QString &datasetName,
915  const QString &layerName,
916  QgsVectorLayer *layer,
917  const QgsAttributeList &attributes );
918 
919  protected:
921  OGRGeometryH createEmptyGeometry( QgsWkbTypes::Type wkbType ) SIP_SKIP;
922 
924  OGRLayerH mLayer = nullptr;
925  OGRSpatialReferenceH mOgrRef = nullptr;
926 
928 
931  QString mErrorMessage;
932 
933  QTextCodec *mCodec = nullptr;
934 
937 
939  QMap<int, int> mAttrIdxToOgrIdx;
940 
942 
943  QMap< QgsSymbolLayer *, QString > mSymbolLayerTable;
944 
947 
948  QString mOgrDriverName;
949 
951  FieldValueConverter *mFieldValueConverter = nullptr;
952 
953  private:
954 #ifdef SIP_RUN
956 #endif
957 
958  struct PreparedWriterDetails
959  {
960  std::unique_ptr< QgsFeatureRenderer > renderer;
962  QgsWkbTypes::Type sourceWkbType = QgsWkbTypes::Unknown;
963  QgsFields sourceFields;
964  QString providerType;
965  long long featureCount = 0;
966  QgsFeatureIds selectedFeatureIds;
967  QString dataSourceUri;
968  QString storageType;
969  QgsFeatureIterator geometryTypeScanIterator;
970  QgsExpressionContext expressionContext;
971  QSet< int > fieldsToConvertToInt;
972  QgsRenderContext renderContext;
973  bool shallTransform = false;
976  QgsAttributeList attributes;
977  QgsFields outputFields;
978  QgsFeatureIterator sourceFeatureIterator;
979  QgsGeometry filterRectGeometry;
980  std::unique_ptr< QgsGeometryEngine > filterRectEngine;
981  QVariantMap providerUriParams;
982  };
983 
988  static QgsVectorFileWriter::WriterError prepareWriteAsVectorFormat( QgsVectorLayer *layer,
990  PreparedWriterDetails &details );
991 
1005  static QgsVectorFileWriter::WriterError writeAsVectorFormatV2( PreparedWriterDetails &details,
1006  const QString &fileName,
1007  const QgsCoordinateTransformContext &transformContext,
1009  QString *newFilename = nullptr,
1010  QString *newLayer = nullptr,
1011  QString *errorMessage SIP_OUT = nullptr );
1012 
1018  Q_DECL_DEPRECATED static QgsVectorFileWriter::WriterError writeAsVectorFormat( PreparedWriterDetails &details,
1019  const QString &fileName,
1021  QString *newFilename = nullptr,
1022  QString *errorMessage SIP_OUT = nullptr,
1023  QString *newLayer = nullptr ) SIP_DEPRECATED;
1024 
1025  void init( QString vectorFileName, QString fileEncoding, const QgsFields &fields,
1026  QgsWkbTypes::Type geometryType, QgsCoordinateReferenceSystem srs,
1027  const QString &driverName, QStringList datasourceOptions,
1028  QStringList layerOptions, QString *newFilename,
1029  QgsVectorFileWriter::FieldValueConverter *fieldValueConverter,
1030  const QString &layerName,
1031  QgsVectorFileWriter::ActionOnExistingFile action, QString *newLayer, QgsFeatureSink::SinkFlags sinkFlags,
1032  const QgsCoordinateTransformContext &transformContext,
1033  FieldNameSource fieldNameSource );
1034  void resetMap( const QgsAttributeList &attributes );
1035 
1036  std::unique_ptr< QgsFeatureRenderer > mRenderer;
1037  QgsRenderContext mRenderContext;
1038 
1039 
1040  std::unique_ptr< QgsCoordinateTransform > mCoordinateTransform;
1041 
1042  bool mUsingTransaction = false;
1043  QSet< QVariant::Type > mSupportedListSubTypes;
1044 
1045  void createSymbolLayerTable( QgsVectorLayer *vl, const QgsCoordinateTransform &ct, OGRDataSourceH ds );
1046  gdal::ogr_feature_unique_ptr createFeature( const QgsFeature &feature );
1047  bool writeFeature( OGRLayerH layer, OGRFeatureH feature );
1048 
1050  QgsVectorFileWriter::WriterError exportFeaturesSymbolLevels( const PreparedWriterDetails &details, QgsFeatureIterator &fit, const QgsCoordinateTransform &ct, QString *errorMessage = nullptr );
1051  double mmScaleFactor( double scale, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits );
1052  double mapUnitScaleFactor( double scale, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits );
1053 
1054  void startRender( QgsFeatureRenderer *sourceRenderer, const QgsFields &fields );
1055  void stopRender();
1056  std::unique_ptr< QgsFeatureRenderer > createSymbologyRenderer( QgsFeatureRenderer *sourceRenderer ) const;
1058  static void addRendererAttributes( QgsFeatureRenderer *renderer, QgsRenderContext &context, const QgsFields &fields, QgsAttributeList &attList );
1059 
1061  static QStringList concatenateOptions( const QMap<QString, Option *> &options );
1062 
1064  friend class TestQgsVectorFileWriter;
1065 };
1066 
1067 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsVectorFileWriter::EditionCapabilities )
1068 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsVectorFileWriter::VectorFormatOptions )
1069 
1070 // clazy:excludeall=qstring-allocations
1071 
1072 #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:125
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.
QStringList attributesExportNames
Attributes export names.
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 > attrIdxToOgrIdx() const
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)
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:134
std::unique_ptr< std::remove_pointer< OGRDataSourceH >::type, OGRDataSourceDeleter > ogr_datasource_unique_ptr
Scoped OGR data source.
Definition: qgsogrutils.h:119
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:882
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,...