28 return QStringLiteral(
"integer" );
30 case QVariant::LongLong:
31 return QStringLiteral(
"long" );
33 case QVariant::Double:
34 return QStringLiteral(
"double" );
36 case QVariant::String:
37 return QStringLiteral(
"string" );
40 return QStringLiteral(
"date" );
43 return QStringLiteral(
"time" );
45 case QVariant::DateTime:
46 return QStringLiteral(
"datetime" );
48 case QVariant::ByteArray:
49 return QStringLiteral(
"binary" );
52 return QStringLiteral(
"boolean" );
57 return QStringLiteral(
"string" );
63 if ( geomType.isNull() )
64 geomType = QStringLiteral(
"none" );
70 parts << QStringLiteral(
"crs=%1" ).arg(
crs.
authid() );
74 for (
const auto &
field : fields )
77 parts << QStringLiteral(
"field=%1:%2%3%4" ).arg( QString( QUrl::toPercentEncoding(
field.
name() ) ),
80 field.
type() == QVariant::List ||
field.
type() == QVariant::StringList ? QStringLiteral(
"[]" ) : QString() );
83 QString uri = geomType +
'?' + parts.join(
'&' );
85 options.skipCrsValidation =
true;
86 return new QgsVectorLayer( uri, name, QStringLiteral(
"memory" ), options );
This class represents a coordinate reference system (CRS).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
QString authid() const
Returns the authority identifier for the CRS.
@ WKT_PREFERRED
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
QString toWkt(WktVariant variant=WKT1_GDAL, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
Contains information about the context in which a coordinate transform is executed.
QVariant::Type subType() const
If the field is a collection, gets its element's type.
Container of fields for a vector layer.
static QgsVectorLayer * createMemoryLayer(const QString &name, const QgsFields &fields, QgsWkbTypes::Type geometryType=QgsWkbTypes::NoGeometry, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) SIP_FACTORY
Creates a new memory layer using the specified parameters.
Represents a vector layer which manages a vector based data sets.
Type
The WKB type describes the number of dimensions a geometry has.
static QString displayString(Type type) SIP_HOLDGIL
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...
QString memoryLayerFieldType(QVariant::Type type)
const QgsCoordinateReferenceSystem & crs
Setting options for loading vector layers.