mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Adding more default SHP->GPKG changes
This commit is contained in:
parent
516540a201
commit
28daa1a0e0
@ -224,7 +224,7 @@ Constructor
|
||||
const QString &fileName,
|
||||
const QString &fileEncoding,
|
||||
const QgsCoordinateReferenceSystem &destCRS = QgsCoordinateReferenceSystem(),
|
||||
const QString &driverName = "ESRI Shapefile",
|
||||
const QString &driverName = "GPKG",
|
||||
bool onlySelected = false,
|
||||
QString *errorMessage /Out/ = 0,
|
||||
const QStringList &datasourceOptions = QStringList(),
|
||||
@ -269,7 +269,7 @@ Constructor
|
||||
const QString &fileName,
|
||||
const QString &fileEncoding,
|
||||
const QgsCoordinateTransform &ct,
|
||||
const QString &driverName = "ESRI Shapefile",
|
||||
const QString &driverName = "GPKG",
|
||||
bool onlySelected = false,
|
||||
QString *errorMessage /Out/ = 0,
|
||||
const QStringList &datasourceOptions = QStringList(),
|
||||
@ -448,7 +448,7 @@ Optional feedback object allowing cancelation of layer save
|
||||
const QgsFields &fields,
|
||||
QgsWkbTypes::Type geometryType,
|
||||
const QgsCoordinateReferenceSystem &srs = QgsCoordinateReferenceSystem(),
|
||||
const QString &driverName = "ESRI Shapefile",
|
||||
const QString &driverName = "GPKG",
|
||||
const QStringList &datasourceOptions = QStringList(),
|
||||
const QStringList &layerOptions = QStringList(),
|
||||
QString *newFilename = 0,
|
||||
|
@ -117,7 +117,7 @@ class DlgExportVector(QDialog, Ui_Dialog):
|
||||
|
||||
# set the last used filter
|
||||
settings = QgsSettings()
|
||||
filt = settings.value(self.lastUsedVectorFilterSettingsKey, "ESRI Shapefile")
|
||||
filt = settings.value(self.lastUsedVectorFilterSettingsKey, "GPKG")
|
||||
|
||||
idx = self.cboFileFormat.findText(filt)
|
||||
if idx < 0:
|
||||
|
@ -306,7 +306,7 @@ void QgsAttributeActionDialog::addDefaultActions()
|
||||
{
|
||||
int pos = 0;
|
||||
insertRow( pos++, QgsAction::Generic, tr( "Echo attribute's value" ), QStringLiteral( "echo \"[% \"MY_FIELD\" %]\"" ), QLatin1String( "" ), true, tr( "Attribute Value" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
|
||||
insertRow( pos++, QgsAction::Generic, tr( "Run an application" ), QStringLiteral( "ogr2ogr -f \"ESRI Shapefile\" \"[% \"OUTPUT_PATH\" %]\" \"[% \"INPUT_FILE\" %]\"" ), QLatin1String( "" ), true, tr( "Run application" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
|
||||
insertRow( pos++, QgsAction::Generic, tr( "Run an application" ), QStringLiteral( "ogr2ogr -f \"GPKG\" \"[% \"OUTPUT_PATH\" %]\" \"[% \"INPUT_FILE\" %]\"" ), QLatin1String( "" ), true, tr( "Run application" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
|
||||
insertRow( pos++, QgsAction::GenericPython, tr( "Get feature id" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nQtWidgets.QMessageBox.information(None, \"Feature id\", \"feature id is [% $id %]\")" ), QLatin1String( "" ), false, tr( "Feature ID" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
|
||||
insertRow( pos++, QgsAction::GenericPython, tr( "Selected field's value (Identify features tool)" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nQtWidgets.QMessageBox.information(None, \"Current field's value\", \"[% @current_field %]\")" ), QLatin1String( "" ), false, tr( "Field Value" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
|
||||
insertRow( pos++, QgsAction::GenericPython, tr( "Clicked coordinates (Run feature actions tool)" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nQtWidgets.QMessageBox.information(None, \"Clicked coords\", \"layer: [% @layer_id %]\\ncoords: ([% @click_x %],[% @click_y %])\")" ), QLatin1String( "" ), false, tr( "Clicked Coordinate" ), QSet<QString>() << QStringLiteral( "Canvas" ), QString() );
|
||||
|
@ -322,8 +322,8 @@ void parseDestinationString( QString &destination, QString &providerKey, QString
|
||||
|
||||
if ( format.isEmpty() )
|
||||
{
|
||||
format = QStringLiteral( "ESRI Shapefile" );
|
||||
destination = destination + QStringLiteral( ".shp" );
|
||||
format = QStringLiteral( "GPKG" );
|
||||
destination = destination + QStringLiteral( ".gpkg" );
|
||||
}
|
||||
|
||||
options.insert( QStringLiteral( "driverName" ), format );
|
||||
|
@ -2306,7 +2306,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe
|
||||
}
|
||||
|
||||
QgsVectorFileWriter::SaveVectorOptions::SaveVectorOptions()
|
||||
: driverName( QStringLiteral( "ESRI Shapefile" ) )
|
||||
: driverName( QStringLiteral( "GPKG" ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ class CORE_EXPORT QgsVectorFileWriter : public QgsFeatureSink
|
||||
const QString &fileName,
|
||||
const QString &fileEncoding,
|
||||
const QgsCoordinateReferenceSystem &destCRS = QgsCoordinateReferenceSystem(),
|
||||
const QString &driverName = "ESRI Shapefile",
|
||||
const QString &driverName = "GPKG",
|
||||
bool onlySelected = false,
|
||||
QString *errorMessage SIP_OUT = nullptr,
|
||||
const QStringList &datasourceOptions = QStringList(),
|
||||
@ -334,7 +334,7 @@ class CORE_EXPORT QgsVectorFileWriter : public QgsFeatureSink
|
||||
const QString &fileName,
|
||||
const QString &fileEncoding,
|
||||
const QgsCoordinateTransform &ct,
|
||||
const QString &driverName = "ESRI Shapefile",
|
||||
const QString &driverName = "GPKG",
|
||||
bool onlySelected = false,
|
||||
QString *errorMessage SIP_OUT = nullptr,
|
||||
const QStringList &datasourceOptions = QStringList(),
|
||||
@ -450,7 +450,7 @@ class CORE_EXPORT QgsVectorFileWriter : public QgsFeatureSink
|
||||
const QgsFields &fields,
|
||||
QgsWkbTypes::Type geometryType,
|
||||
const QgsCoordinateReferenceSystem &srs = QgsCoordinateReferenceSystem(),
|
||||
const QString &driverName = "ESRI Shapefile",
|
||||
const QString &driverName = "GPKG",
|
||||
const QStringList &datasourceOptions = QStringList(),
|
||||
const QStringList &layerOptions = QStringList(),
|
||||
QString *newFilename = nullptr,
|
||||
|
@ -94,7 +94,7 @@ void QgsVectorLayerSaveAsDialog::setup()
|
||||
mFormatComboBox->addItem( it.key(), it.value() );
|
||||
}
|
||||
|
||||
QString format = settings.value( QStringLiteral( "UI/lastVectorFormat" ), "ESRI Shapefile" ).toString();
|
||||
QString format = settings.value( QStringLiteral( "UI/lastVectorFormat" ), "GPKG" ).toString();
|
||||
mFormatComboBox->setCurrentIndex( mFormatComboBox->findData( format ) );
|
||||
mFormatComboBox->blockSignals( false );
|
||||
|
||||
|
@ -227,7 +227,7 @@ void QgsGeometryCheckerResultTab::exportErrors()
|
||||
initialdir = dir.absolutePath();
|
||||
}
|
||||
|
||||
QString file = QFileDialog::getSaveFileName( this, tr( "Select Output File" ), initialdir, tr( "ESRI Shapefile (*.shp);;" ) );
|
||||
QString file = QFileDialog::getSaveFileName( this, tr( "Select Output File" ), initialdir, tr( "GeoPackage (*.gpkg);;" ) );
|
||||
if ( file.isEmpty() )
|
||||
{
|
||||
return;
|
||||
|
@ -130,7 +130,7 @@ void QgsGeometryCheckerSetupTab::validateInput()
|
||||
|
||||
void QgsGeometryCheckerSetupTab::selectOutputFile()
|
||||
{
|
||||
QString filterString = QgsVectorFileWriter::filterForDriver( QStringLiteral( "ESRI Shapefile" ) );
|
||||
QString filterString = QgsVectorFileWriter::filterForDriver( QStringLiteral( "GPKG" ) );
|
||||
QMap<QString, QString> filterFormatMap = QgsVectorFileWriter::supportedFiltersAndFormats();
|
||||
Q_FOREACH ( const QString &filter, filterFormatMap.keys() )
|
||||
{
|
||||
|
@ -217,7 +217,7 @@ QgsVectorLayerExporter::ExportError QgsOgrProvider::createEmptyLayer( const QStr
|
||||
const QMap<QString, QVariant> *options )
|
||||
{
|
||||
QString encoding;
|
||||
QString driverName = QStringLiteral( "ESRI Shapefile" );
|
||||
QString driverName = QStringLiteral( "GPKG" );
|
||||
QStringList dsOptions, layerOptions;
|
||||
QString layerName;
|
||||
|
||||
|
@ -376,7 +376,7 @@ void TestQgsProcessing::initTestCase()
|
||||
void TestQgsProcessing::cleanupTestCase()
|
||||
{
|
||||
QFile::remove( QDir::tempPath() + "/create_feature_sink.tab" );
|
||||
QgsVectorFileWriter::deleteShapeFile( QDir::tempPath() + "/create_feature_sink2.shp" );
|
||||
QgsVectorFileWriter::deleteShapeFile( QDir::tempPath() + "/create_feature_sink2.gpkg" );
|
||||
|
||||
QgsApplication::exitQgis();
|
||||
}
|
||||
@ -1211,7 +1211,7 @@ void TestQgsProcessing::createFeatureSink()
|
||||
|
||||
// no extension, should default to shp
|
||||
destination = QDir::tempPath() + "/create_feature_sink2";
|
||||
prevDest = QDir::tempPath() + "/create_feature_sink2.shp";
|
||||
prevDest = QDir::tempPath() + "/create_feature_sink2.gpkg";
|
||||
sink.reset( QgsProcessingUtils::createFeatureSink( destination, context, fields, QgsWkbTypes::Point25D, QgsCoordinateReferenceSystem::fromEpsgId( 3111 ) ) );
|
||||
QVERIFY( sink.get() );
|
||||
f.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "PointZ(1 2 3)" ) ) );
|
||||
@ -1222,9 +1222,10 @@ void TestQgsProcessing::createFeatureSink()
|
||||
layer = qobject_cast< QgsVectorLayer *>( QgsProcessingUtils::mapLayerFromString( destination, context, true ) );
|
||||
QCOMPARE( layer->wkbType(), QgsWkbTypes::Point25D );
|
||||
QCOMPARE( layer->crs().authid(), QStringLiteral( "EPSG:3111" ) );
|
||||
QCOMPARE( layer->fields().size(), 1 );
|
||||
QCOMPARE( layer->fields().at( 0 ).name(), QStringLiteral( "my_field" ) );
|
||||
QCOMPARE( layer->fields().at( 0 ).type(), QVariant::String );
|
||||
QCOMPARE( layer->fields().size(), 2 );
|
||||
QCOMPARE( layer->fields().at( 0 ).name(), QStringLiteral( "fid" ) );
|
||||
QCOMPARE( layer->fields().at( 1 ).name(), QStringLiteral( "my_field" ) );
|
||||
QCOMPARE( layer->fields().at( 1 ).type(), QVariant::String );
|
||||
QCOMPARE( layer->featureCount(), 1L );
|
||||
delete layer;
|
||||
layer = nullptr;
|
||||
|
@ -109,7 +109,7 @@ void TestQgsMapRendererJob::initTestCase()
|
||||
QString myDataDir( TEST_DATA_DIR ); //defined in CmakeLists.txt
|
||||
QString myTestDataDir = myDataDir + '/';
|
||||
QString myTmpDir = QDir::tempPath() + '/';
|
||||
QString myFileName = myTmpDir + "maprender_testdata.shp";
|
||||
QString myFileName = myTmpDir + "maprender_testdata.gpkg";
|
||||
//copy over the default qml for our generated layer
|
||||
QString myQmlFileName = myTestDataDir + "maprender_testdata.qml";
|
||||
QFile::remove( myTmpDir + "maprender_testdata.qml" );
|
||||
|
BIN
tests/testdata/polys_overlapping_with_id.dbf
vendored
BIN
tests/testdata/polys_overlapping_with_id.dbf
vendored
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user