2017-05-22 09:01:45 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsvectorfilewriter.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-26 10:56:39 +10:00
|
|
|
class QgsVectorFileWriter : QgsFeatureSink
|
2007-04-11 11:46:35 +00:00
|
|
|
{
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
A convenience class for writing vector files to disk.
|
2017-05-22 09:01:45 +02:00
|
|
|
There are two possibilities how to use this class:
|
|
|
|
1. static call to QgsVectorFileWriter.writeAsVectorFormat(...) which saves the whole vector layer
|
|
|
|
2. create an instance of the class and issue calls to addFeature(...)
|
2007-04-11 11:46:35 +00:00
|
|
|
%End
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsvectorfilewriter.h"
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
public:
|
2014-01-26 18:35:21 +01:00
|
|
|
enum OptionType
|
|
|
|
{
|
|
|
|
Set,
|
|
|
|
String,
|
|
|
|
Int,
|
|
|
|
Hidden
|
|
|
|
};
|
|
|
|
|
|
|
|
class Option
|
2017-05-22 09:01:45 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsvectorfilewriter.h"
|
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
public:
|
2017-05-01 16:42:33 +02:00
|
|
|
Option( const QString &docString, QgsVectorFileWriter::OptionType type );
|
2014-01-26 18:35:21 +01:00
|
|
|
|
|
|
|
QString docString;
|
|
|
|
QgsVectorFileWriter::OptionType type;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SetOption : QgsVectorFileWriter::Option
|
2017-05-22 09:01:45 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsvectorfilewriter.h"
|
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
public:
|
2017-05-01 16:42:33 +02:00
|
|
|
SetOption( const QString &docString, const QStringList &values, const QString &defaultValue, bool allowNone = false );
|
2014-01-26 18:35:21 +01:00
|
|
|
|
|
|
|
QSet<QString> values;
|
|
|
|
QString defaultValue;
|
|
|
|
bool allowNone;
|
|
|
|
};
|
|
|
|
|
|
|
|
class StringOption: QgsVectorFileWriter::Option
|
2017-05-22 09:01:45 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsvectorfilewriter.h"
|
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
public:
|
2017-05-01 16:42:33 +02:00
|
|
|
StringOption( const QString &docString, const QString &defaultValue = QString() );
|
2014-01-26 18:35:21 +01:00
|
|
|
|
|
|
|
QString defaultValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IntOption: QgsVectorFileWriter::Option
|
2017-05-22 09:01:45 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsvectorfilewriter.h"
|
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
public:
|
2017-05-01 16:42:33 +02:00
|
|
|
IntOption( const QString &docString, int defaultValue );
|
2014-01-26 18:35:21 +01:00
|
|
|
|
|
|
|
int defaultValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
class BoolOption : QgsVectorFileWriter::SetOption
|
2017-05-22 09:01:45 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsvectorfilewriter.h"
|
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
public:
|
2017-05-01 16:42:33 +02:00
|
|
|
BoolOption( const QString &docString, bool defaultValue );
|
2014-01-26 18:35:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class HiddenOption : QgsVectorFileWriter::Option
|
2017-05-22 09:01:45 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsvectorfilewriter.h"
|
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
public:
|
2017-05-22 09:01:45 +02:00
|
|
|
explicit HiddenOption( const QString &value );
|
2014-01-26 18:35:21 +01:00
|
|
|
|
|
|
|
QString mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MetaData
|
|
|
|
{
|
|
|
|
MetaData();
|
2017-11-11 15:22:19 +10:00
|
|
|
%Docstring
|
|
|
|
Constructor for MetaData
|
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
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() );
|
2014-01-26 18:35:21 +01:00
|
|
|
|
|
|
|
QString longName;
|
|
|
|
QString trLongName;
|
|
|
|
QString glob;
|
|
|
|
QString ext;
|
2017-05-22 09:01:45 +02:00
|
|
|
QMap<QString, QgsVectorFileWriter::Option *> driverOptions;
|
|
|
|
QMap<QString, QgsVectorFileWriter::Option *> layerOptions;
|
QgsVectorFileWriter::MetaData: add a compulsoryEncoding member
* Some formats require a compulsory encoding, typically UTF-8.
Change initMetadata() to indicate UTF-8 compulsory encoding for
GeoJSON, GeoRSS, GML, GPKG, GPX, KML, SQLite, SpatiaLite, FileGDB,
XLSX and ODS
* QgsVectorFileWriter::init(): make it override the user specified
encoding if the format has a compulsory encoding. And remove hard-coded
case for KML.
2016-05-19 11:38:42 +02:00
|
|
|
QString compulsoryEncoding;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Some formats require a compulsory encoding, typically UTF-8. If no compulsory encoding, empty string
|
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
};
|
|
|
|
|
2007-04-11 11:46:35 +00:00
|
|
|
enum WriterError
|
|
|
|
{
|
2014-06-02 21:00:51 +02:00
|
|
|
NoError,
|
2007-04-11 11:46:35 +00:00
|
|
|
ErrDriverNotFound,
|
|
|
|
ErrCreateDataSource,
|
2011-08-04 19:48:54 +02:00
|
|
|
ErrCreateLayer,
|
|
|
|
ErrAttributeTypeUnsupported,
|
|
|
|
ErrAttributeCreationFailed,
|
2014-11-21 01:17:21 +01:00
|
|
|
ErrProjection,
|
|
|
|
ErrFeatureWriteFailed,
|
|
|
|
ErrInvalidLayer,
|
2017-02-11 14:41:21 +10:00
|
|
|
Canceled,
|
2007-04-11 11:46:35 +00:00
|
|
|
};
|
|
|
|
|
2013-10-31 16:07:27 +01:00
|
|
|
enum SymbologyExport
|
|
|
|
{
|
2017-05-22 09:01:45 +02:00
|
|
|
NoSymbology,
|
|
|
|
FeatureSymbology,
|
|
|
|
SymbolLayerSymbology
|
2013-10-31 16:07:27 +01:00
|
|
|
};
|
|
|
|
|
2017-11-05 14:18:14 +10:00
|
|
|
|
|
|
|
enum VectorFormatOption
|
|
|
|
{
|
|
|
|
SortRecommended,
|
2017-11-06 07:49:31 +10:00
|
|
|
SkipNonSpatialFormats,
|
2017-11-05 14:18:14 +10:00
|
|
|
};
|
|
|
|
typedef QFlags<QgsVectorFileWriter::VectorFormatOption> VectorFormatOptions;
|
|
|
|
|
|
|
|
|
2016-05-03 18:53:21 +02:00
|
|
|
class FieldValueConverter
|
2017-05-22 09:01:45 +02:00
|
|
|
{
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Interface to convert raw field values to their user-friendly value.
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsvectorfilewriter.h"
|
|
|
|
%End
|
2016-05-03 18:53:21 +02:00
|
|
|
public:
|
|
|
|
FieldValueConverter();
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Constructor
|
|
|
|
%End
|
2016-05-03 18:53:21 +02:00
|
|
|
|
|
|
|
virtual ~FieldValueConverter();
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual QgsField fieldDefinition( const QgsField &field );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Return a possibly modified field definition. Default implementation will return provided field unmodified.
|
|
|
|
:param field: original field definition
|
|
|
|
|
|
|
|
:return: possibly modified field definition
|
|
|
|
:rtype: QgsField
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2016-05-03 18:53:21 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual QVariant convert( int fieldIdxInLayer, const QVariant &value );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Convert the provided value, for field fieldIdxInLayer. Default implementation will return provided value unmodified.
|
|
|
|
:param fieldIdxInLayer: field index
|
|
|
|
:param value: original raw value
|
|
|
|
|
|
|
|
:return: possibly modified value.
|
|
|
|
:rtype: QVariant
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2017-06-10 18:53:01 +10:00
|
|
|
|
|
|
|
virtual QgsVectorFileWriter::FieldValueConverter *clone() const /Factory/;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Creates a clone of the FieldValueConverter.
|
|
|
|
|
|
|
|
:rtype: QgsVectorFileWriter.FieldValueConverter
|
2017-06-10 18:53:01 +10:00
|
|
|
%End
|
2016-05-03 18:53:21 +02:00
|
|
|
};
|
|
|
|
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
enum EditionCapability
|
|
|
|
{
|
2017-05-22 09:01:45 +02:00
|
|
|
//! Flag
|
|
|
|
CanAddNewLayer,
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
//! Flag
|
|
|
|
CanAppendToExistingLayer,
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
//! Flag
|
|
|
|
CanAddNewFieldsToExistingLayer,
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
//! Flag
|
|
|
|
CanDeleteLayer
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef QFlags<QgsVectorFileWriter::EditionCapability> EditionCapabilities;
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
enum ActionOnExistingFile
|
|
|
|
{
|
2017-05-22 09:01:45 +02:00
|
|
|
//! Create
|
|
|
|
CreateOrOverwriteFile,
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
//! Create
|
|
|
|
CreateOrOverwriteLayer,
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
//! Append
|
|
|
|
AppendToLayerNoNewFields,
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
//! Append
|
|
|
|
AppendToLayerAddFields
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
};
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
static QgsVectorFileWriter::WriterError writeAsVectorFormat( QgsVectorLayer *layer,
|
|
|
|
const QString &fileName,
|
|
|
|
const QString &fileEncoding,
|
|
|
|
const QgsCoordinateReferenceSystem &destCRS = QgsCoordinateReferenceSystem(),
|
2017-10-18 14:10:26 +02:00
|
|
|
const QString &driverName = "GPKG",
|
2017-05-22 09:01:45 +02:00
|
|
|
bool onlySelected = false,
|
2017-09-18 18:31:46 +02:00
|
|
|
QString *errorMessage /Out/ = 0,
|
2017-05-22 09:01:45 +02:00
|
|
|
const QStringList &datasourceOptions = QStringList(),
|
|
|
|
const QStringList &layerOptions = QStringList(),
|
|
|
|
bool skipAttributeCreation = false,
|
|
|
|
QString *newFilename = 0,
|
|
|
|
QgsVectorFileWriter::SymbologyExport symbologyExport = QgsVectorFileWriter::NoSymbology,
|
|
|
|
double symbologyScale = 1.0,
|
|
|
|
const QgsRectangle *filterExtent = 0,
|
|
|
|
QgsWkbTypes::Type overrideGeometryType = QgsWkbTypes::Unknown,
|
|
|
|
bool forceMulti = false,
|
|
|
|
bool includeZ = false,
|
|
|
|
const QgsAttributeList &attributes = QgsAttributeList(),
|
|
|
|
QgsVectorFileWriter::FieldValueConverter *fieldValueConverter = 0
|
|
|
|
);
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Write contents of vector layer to an (OGR supported) vector formt
|
|
|
|
:param layer: layer to write
|
|
|
|
:param fileName: file name to write to
|
|
|
|
:param fileEncoding: encoding to use
|
|
|
|
:param destCRS: CRS to reproject exported geometries to, or invalid CRS for no reprojection
|
|
|
|
:param driverName: OGR driver to use
|
|
|
|
:param onlySelected: write only selected features of layer
|
|
|
|
:param errorMessage: pointer to buffer fo error message
|
|
|
|
:param datasourceOptions: list of OGR data source creation options
|
|
|
|
:param layerOptions: list of OGR layer creation options
|
|
|
|
:param skipAttributeCreation: only write geometries
|
|
|
|
:param newFilename: QString pointer which will contain the new file name created (in case it is different to fileName).
|
|
|
|
:param symbologyExport: symbology to export
|
|
|
|
:param symbologyScale: scale of symbology
|
|
|
|
:param filterExtent: if not a null pointer, only features intersecting the extent will be saved (added in QGIS 2.4)
|
|
|
|
:param overrideGeometryType: set to a valid geometry type to override the default geometry type for the layer. This parameter
|
|
|
|
allows for conversion of geometryless tables to null geometries, etc (added in QGIS 2.14)
|
|
|
|
:param forceMulti: set to true to force creation of multi* geometries (added in QGIS 2.14)
|
|
|
|
:param includeZ: set to true to include z dimension in output. This option is only valid if overrideGeometryType is set. (added in QGIS 2.14)
|
|
|
|
:param attributes: attributes to export (empty means all unless skipAttributeCreation is set)
|
|
|
|
:param fieldValueConverter: field value converter (added in QGIS 2.16)
|
|
|
|
|
|
|
|
:rtype: QgsVectorFileWriter.WriterError
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
static QgsVectorFileWriter::WriterError writeAsVectorFormat( QgsVectorLayer *layer,
|
|
|
|
const QString &fileName,
|
|
|
|
const QString &fileEncoding,
|
|
|
|
const QgsCoordinateTransform &ct,
|
2017-10-18 14:10:26 +02:00
|
|
|
const QString &driverName = "GPKG",
|
2017-05-22 09:01:45 +02:00
|
|
|
bool onlySelected = false,
|
2017-09-18 18:31:46 +02:00
|
|
|
QString *errorMessage /Out/ = 0,
|
2017-05-22 09:01:45 +02:00
|
|
|
const QStringList &datasourceOptions = QStringList(),
|
|
|
|
const QStringList &layerOptions = QStringList(),
|
|
|
|
bool skipAttributeCreation = false,
|
|
|
|
QString *newFilename = 0,
|
|
|
|
QgsVectorFileWriter::SymbologyExport symbologyExport = QgsVectorFileWriter::NoSymbology,
|
|
|
|
double symbologyScale = 1.0,
|
|
|
|
const QgsRectangle *filterExtent = 0,
|
|
|
|
QgsWkbTypes::Type overrideGeometryType = QgsWkbTypes::Unknown,
|
|
|
|
bool forceMulti = false,
|
|
|
|
bool includeZ = false,
|
|
|
|
const QgsAttributeList &attributes = QgsAttributeList(),
|
|
|
|
QgsVectorFileWriter::FieldValueConverter *fieldValueConverter = 0
|
|
|
|
);
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Writes a layer out to a vector file.
|
|
|
|
:param layer: layer to write
|
|
|
|
:param fileName: file name to write to
|
|
|
|
:param fileEncoding: encoding to use
|
|
|
|
:param ct: coordinate transform to reproject exported geometries with, or invalid transform
|
|
|
|
for no transformation
|
|
|
|
:param driverName: OGR driver to use
|
|
|
|
:param onlySelected: write only selected features of layer
|
|
|
|
:param errorMessage: pointer to buffer fo error message
|
|
|
|
:param datasourceOptions: list of OGR data source creation options
|
|
|
|
:param layerOptions: list of OGR layer creation options
|
|
|
|
:param skipAttributeCreation: only write geometries
|
|
|
|
:param newFilename: QString pointer which will contain the new file name created (in case it is different to fileName).
|
|
|
|
:param symbologyExport: symbology to export
|
|
|
|
:param symbologyScale: scale of symbology
|
|
|
|
:param filterExtent: if not a null pointer, only features intersecting the extent will be saved (added in QGIS 2.4)
|
|
|
|
:param overrideGeometryType: set to a valid geometry type to override the default geometry type for the layer. This parameter
|
|
|
|
allows for conversion of geometryless tables to null geometries, etc (added in QGIS 2.14)
|
|
|
|
:param forceMulti: set to true to force creation of multi* geometries (added in QGIS 2.14)
|
|
|
|
:param includeZ: set to true to include z dimension in output. This option is only valid if overrideGeometryType is set. (added in QGIS 2.14)
|
|
|
|
:param attributes: attributes to export (empty means all unless skipAttributeCreation is set)
|
|
|
|
:param fieldValueConverter: field value converter (added in QGIS 2.16)
|
|
|
|
|
|
|
|
:rtype: QgsVectorFileWriter.WriterError
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 2.2
|
|
|
|
%End
|
|
|
|
|
|
|
|
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
class SaveVectorOptions
|
2017-05-22 09:01:45 +02:00
|
|
|
{
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Options to pass to writeAsVectorFormat()
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsvectorfilewriter.h"
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
public:
|
|
|
|
SaveVectorOptions();
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Constructor
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
virtual ~SaveVectorOptions();
|
|
|
|
|
|
|
|
QString driverName;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
OGR driver to use
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QString layerName;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Layer name. If let empty, it will be derived from the filename
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QgsVectorFileWriter::ActionOnExistingFile actionOnExistingFile;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Action on existing file
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QString fileEncoding;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Encoding to use
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QgsCoordinateTransform ct;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Transform to reproject exported geometries with, or invalid transform
|
|
|
|
for no transformation *
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
bool onlySelectedFeatures;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Write only selected features of layer
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QStringList datasourceOptions;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
List of OGR data source creation options
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QStringList layerOptions;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
List of OGR layer creation options
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
bool skipAttributeCreation;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Only write geometries
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QgsAttributeList attributes;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Attributes to export (empty means all unless skipAttributeCreation is set)
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QgsVectorFileWriter::SymbologyExport symbologyExport;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Symbology to export
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
double symbologyScale;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Scale of symbology
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QgsRectangle filterExtent;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
If not empty, only features intersecting the extent will be saved
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QgsWkbTypes::Type overrideGeometryType;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set to a valid geometry type to override the default geometry type for the layer. This parameter
|
|
|
|
allows for conversion of geometryless tables to null geometries, etc *
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
bool forceMulti;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Set to true to force creation of multi* geometries
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
bool includeZ;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Set to true to include z dimension in output. This option is only valid if overrideGeometryType is set
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsVectorFileWriter::FieldValueConverter *fieldValueConverter;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Field value converter.
|
2017-06-10 18:53:01 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
Ownership is not transferred and callers must ensure that the lifetime of fieldValueConverter
|
|
|
|
exceeds the lifetime of the QgsVectorFileWriter object.
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2017-02-11 14:41:21 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsFeedback *feedback;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Optional feedback object allowing cancelation of layer save
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
};
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
static QgsVectorFileWriter::WriterError writeAsVectorFormat( QgsVectorLayer *layer,
|
|
|
|
const QString &fileName,
|
|
|
|
const QgsVectorFileWriter::SaveVectorOptions &options,
|
|
|
|
QString *newFilename = 0,
|
2017-09-18 18:31:46 +02:00
|
|
|
QString *errorMessage /Out/ = 0 );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Writes a layer out to a vector file.
|
|
|
|
:param layer: source layer to write
|
|
|
|
:param fileName: file name to write to
|
|
|
|
:param options: options.
|
|
|
|
:param newFilename: QString pointer which will contain the new file name created (in case it is different to fileName).
|
|
|
|
:param errorMessage: pointer to buffer fo error message
|
|
|
|
|
|
|
|
:rtype: QgsVectorFileWriter.WriterError
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
QgsVectorFileWriter( const QString &vectorFileName,
|
|
|
|
const QString &fileEncoding,
|
|
|
|
const QgsFields &fields,
|
2016-08-04 09:10:08 +02:00
|
|
|
QgsWkbTypes::Type geometryType,
|
2017-05-22 09:01:45 +02:00
|
|
|
const QgsCoordinateReferenceSystem &srs = QgsCoordinateReferenceSystem(),
|
2017-10-18 14:10:26 +02:00
|
|
|
const QString &driverName = "GPKG",
|
2016-01-08 17:35:19 +01:00
|
|
|
const QStringList &datasourceOptions = QStringList(),
|
|
|
|
const QStringList &layerOptions = QStringList(),
|
2017-05-02 07:21:20 +02:00
|
|
|
QString *newFilename = 0,
|
2017-05-22 09:01:45 +02:00
|
|
|
QgsVectorFileWriter::SymbologyExport symbologyExport = QgsVectorFileWriter::NoSymbology
|
2012-11-22 10:35:20 +02:00
|
|
|
);
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Create a new vector file writer
|
|
|
|
%End
|
|
|
|
|
|
|
|
|
2010-03-18 22:24:18 +00:00
|
|
|
|
2017-11-06 07:34:01 +10:00
|
|
|
struct FilterFormatDetails
|
|
|
|
{
|
|
|
|
QString driverName;
|
|
|
|
%Docstring
|
|
|
|
Unique driver name
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString filterString;
|
|
|
|
%Docstring
|
|
|
|
Filter string for file picker dialogs
|
|
|
|
%End
|
|
|
|
};
|
|
|
|
|
|
|
|
static QList< QgsVectorFileWriter::FilterFormatDetails > supportedFiltersAndFormats( VectorFormatOptions options = SortRecommended );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a list or pairs, with format filter string as first element and OGR format key as second element.
|
|
|
|
|
|
|
|
The ``options`` argument can be used to control the sorting and filtering of
|
|
|
|
returned formats.
|
2017-11-05 14:18:14 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:rtype: list of QgsVectorFileWriter.FilterFormatDetails
|
2017-11-05 14:18:14 +10:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`supportedOutputVectorLayerExtensions()`
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
|
|
|
|
2017-11-05 14:18:14 +10:00
|
|
|
static QStringList supportedFormatExtensions( VectorFormatOptions options = SortRecommended );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a list of file extensions for supported formats.
|
|
|
|
|
|
|
|
The ``options`` argument can be used to control the sorting and filtering of
|
|
|
|
returned formats.
|
2017-11-05 14:18:14 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:rtype: list of str
|
2017-11-05 14:18:14 +10:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 3.0
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`supportedFiltersAndFormats()`
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2010-03-18 22:24:18 +00:00
|
|
|
|
2017-12-11 11:15:18 +10:00
|
|
|
static bool supportsFeatureStyles( const QString &driverName );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns true if the specified ``driverName`` supports feature styles.
|
|
|
|
|
|
|
|
The ``driverName`` argument must be a valid GDAL driver name.
|
2017-12-11 11:15:18 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:rtype: bool
|
2017-12-11 11:15:18 +10:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-11-06 07:19:39 +10:00
|
|
|
struct DriverDetails
|
|
|
|
{
|
|
|
|
QString longName;
|
|
|
|
%Docstring
|
|
|
|
Descriptive, user friendly name for the driver
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString driverName;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-11-06 07:19:39 +10:00
|
|
|
Unique driver name
|
|
|
|
%End
|
|
|
|
};
|
|
|
|
|
|
|
|
static QList< QgsVectorFileWriter::DriverDetails > ogrDriverList( VectorFormatOptions options = SortRecommended );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the driver list that can be used for dialogs. It contains all OGR drivers
|
|
|
|
plus some additional internal QGIS driver names to distinguish between more
|
|
|
|
supported formats of the same OGR driver.
|
|
|
|
|
|
|
|
The returned list consists of structs containing the driver long name (e.g. user-friendly
|
|
|
|
display name for the format) and internal driver short name.
|
2017-11-05 14:18:14 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
The ``options`` argument can be used to control the sorting and filtering of
|
|
|
|
returned drivers.
|
2017-11-05 14:18:14 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:rtype: list of QgsVectorFileWriter.DriverDetails
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-03 17:13:05 +10:00
|
|
|
static QString driverForExtension( const QString &extension );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the OGR driver name for a specified file ``extension``. E.g. the
|
|
|
|
driver name for the ".shp" extension is "ESRI Shapefile".
|
|
|
|
If no suitable drivers are found then an empty string is returned.
|
|
|
|
|
|
|
|
:rtype: str
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-05-03 17:13:05 +10:00
|
|
|
|
2017-11-05 14:18:14 +10:00
|
|
|
static QString fileFilterString( VectorFormatOptions options = SortRecommended );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns filter string that can be used for dialogs.
|
|
|
|
|
|
|
|
The ``options`` argument can be used to control the sorting and filtering of
|
|
|
|
returned drivers.
|
2017-11-05 14:18:14 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:rtype: str
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2010-03-18 22:24:18 +00:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
static QString filterForDriver( const QString &driverName );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Creates a filter for an OGR driver key
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:rtype: str
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
static QString convertCodecNameForEncodingOption( const QString &codecName );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Converts codec name to string passed to ENCODING layer creation option of OGR Shapefile
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:rtype: str
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
QgsVectorFileWriter::WriterError hasError();
|
|
|
|
%Docstring
|
|
|
|
Checks whether there were any errors in constructor
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:rtype: QgsVectorFileWriter.WriterError
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2010-02-06 19:27:36 +00:00
|
|
|
|
|
|
|
QString errorMessage();
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Retrieves error message
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:rtype: str
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
|
|
|
|
2017-06-15 12:08:43 +10:00
|
|
|
virtual bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = 0 );
|
2017-05-22 09:01:45 +02:00
|
|
|
|
2017-06-15 12:08:43 +10:00
|
|
|
virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-04-26 10:56:39 +10:00
|
|
|
|
2017-06-15 13:24:01 +10:00
|
|
|
bool addFeatureWithStyle( QgsFeature &feature, QgsFeatureRenderer *renderer, QgsUnitTypes::DistanceUnit outputUnit = QgsUnitTypes::DistanceMeters );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Adds a ``feature`` to the currently opened data source, using the style from a specified ``renderer``.
|
|
|
|
|
|
|
|
:rtype: bool
|
|
|
|
|
2017-06-15 13:24:01 +10:00
|
|
|
.. versionadded:: 3.0
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
|
2007-04-11 11:46:35 +00:00
|
|
|
~QgsVectorFileWriter();
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
|
|
|
Close opened shapefile for writing
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
static bool deleteShapeFile( const QString &fileName );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Delete a shapefile (and its accompanying shx / dbf / prf)
|
|
|
|
:param fileName: /path/to/file.shp
|
|
|
|
|
|
|
|
:return: bool true if the file was deleted successfully
|
|
|
|
:rtype: bool
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
QgsVectorFileWriter::SymbologyExport symbologyExport() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:rtype: QgsVectorFileWriter.SymbologyExport
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
|
|
|
void setSymbologyExport( QgsVectorFileWriter::SymbologyExport symExport );
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2017-06-09 10:26:01 +10:00
|
|
|
double symbologyScale() const;
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the reference scale for output.
|
|
|
|
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
|
|
|
|
|
|
|
|
:rtype: float
|
|
|
|
|
2017-06-09 10:26:01 +10:00
|
|
|
.. versionadded:: 3.0
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setSymbologyScale()`
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2017-06-09 10:26:01 +10:00
|
|
|
|
|
|
|
void setSymbologyScale( double scale );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set reference ``scale`` for output.
|
|
|
|
The ``scale`` value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
|
|
|
|
|
2017-06-09 10:26:01 +10:00
|
|
|
.. versionadded:: 3.0
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`symbologyScale()`
|
2017-06-09 10:26:01 +10:00
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
static bool driverMetadata( const QString &driverName, MetaData &driverMetadata );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:rtype: bool
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
static QStringList defaultDatasetOptions( const QString &driverName );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a list of the default dataset options for a specified driver.
|
|
|
|
:param driverName: name of OGR driver
|
|
|
|
|
|
|
|
:rtype: list of str
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 3.0
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`defaultLayerOptions()`
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
2016-08-11 19:07:41 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
static QStringList defaultLayerOptions( const QString &driverName );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a list of the default layer options for a specified driver.
|
|
|
|
:param driverName: name of OGR driver
|
|
|
|
|
|
|
|
:rtype: list of str
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 3.0
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`defaultDatasetOptions()`
|
2017-05-22 09:01:45 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
|
|
|
|
static QgsVectorFileWriter::EditionCapabilities editionCapabilities( const QString &datasetName );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Return edition capabilities for an existing dataset name.
|
|
|
|
|
|
|
|
:rtype: QgsVectorFileWriter.EditionCapabilities
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-08-11 19:07:41 +10:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
static bool targetLayerExists( const QString &datasetName,
|
2017-05-01 16:42:33 +02:00
|
|
|
const QString &layerName );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns whether the target layer already exists.
|
|
|
|
|
|
|
|
:rtype: bool
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
static bool areThereNewFieldsToCreate( const QString &datasetName,
|
|
|
|
const QString &layerName,
|
|
|
|
QgsVectorLayer *layer,
|
2017-05-01 16:42:33 +02:00
|
|
|
const QgsAttributeList &attributes );
|
2017-05-22 09:01:45 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns whether there are among the attributes specified some that do not exist yet in the layer
|
|
|
|
|
|
|
|
:rtype: bool
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
protected:
|
2016-01-22 18:45:45 +11:00
|
|
|
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsVectorFileWriter( const QgsVectorFileWriter &rh );
|
2007-04-11 11:46:35 +00:00
|
|
|
};
|
[FEATURE] Vector layer save as: offer file/layer overwriting, new layer creation, feature and field appending
When saving a vector layer into an existing file, depending on the capabilities
of the output driver, the user can now decide whether:
- to overwrite the whole file
- to overwrite only the target layer (layer name is now configurable)
- to append features to the existing target layer
- to append features, add new fields if there are any.
All above is available for drivers like GPKG, SpatiaLite, FileGDB, ...
For drivers like Shapefile, MapInfo .tab, feature append is also available.
2016-10-13 00:16:22 +02:00
|
|
|
|
|
|
|
QFlags<QgsVectorFileWriter::EditionCapability> operator|(QgsVectorFileWriter::EditionCapability f1, QFlags<QgsVectorFileWriter::EditionCapability> f2);
|
2017-05-22 09:01:45 +02:00
|
|
|
|
2017-11-05 14:18:14 +10:00
|
|
|
QFlags<QgsVectorFileWriter::VectorFormatOption> operator|(QgsVectorFileWriter::VectorFormatOption f1, QFlags<QgsVectorFileWriter::VectorFormatOption> f2);
|
|
|
|
|
2017-05-22 09:01:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsvectorfilewriter.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|