Skip to content

Commit 28daa1a

Browse files
committedOct 19, 2017
Adding more default SHP->GPKG changes
1 parent 516540a commit 28daa1a

File tree

13 files changed

+22
-21
lines changed

13 files changed

+22
-21
lines changed
 

‎python/core/qgsvectorfilewriter.sip

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Constructor
224224
const QString &fileName,
225225
const QString &fileEncoding,
226226
const QgsCoordinateReferenceSystem &destCRS = QgsCoordinateReferenceSystem(),
227-
const QString &driverName = "ESRI Shapefile",
227+
const QString &driverName = "GPKG",
228228
bool onlySelected = false,
229229
QString *errorMessage /Out/ = 0,
230230
const QStringList &datasourceOptions = QStringList(),
@@ -269,7 +269,7 @@ Constructor
269269
const QString &fileName,
270270
const QString &fileEncoding,
271271
const QgsCoordinateTransform &ct,
272-
const QString &driverName = "ESRI Shapefile",
272+
const QString &driverName = "GPKG",
273273
bool onlySelected = false,
274274
QString *errorMessage /Out/ = 0,
275275
const QStringList &datasourceOptions = QStringList(),
@@ -448,7 +448,7 @@ Optional feedback object allowing cancelation of layer save
448448
const QgsFields &fields,
449449
QgsWkbTypes::Type geometryType,
450450
const QgsCoordinateReferenceSystem &srs = QgsCoordinateReferenceSystem(),
451-
const QString &driverName = "ESRI Shapefile",
451+
const QString &driverName = "GPKG",
452452
const QStringList &datasourceOptions = QStringList(),
453453
const QStringList &layerOptions = QStringList(),
454454
QString *newFilename = 0,

‎python/plugins/db_manager/dlg_export_vector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def populateFileFilters(self):
117117

118118
# set the last used filter
119119
settings = QgsSettings()
120-
filt = settings.value(self.lastUsedVectorFilterSettingsKey, "ESRI Shapefile")
120+
filt = settings.value(self.lastUsedVectorFilterSettingsKey, "GPKG")
121121

122122
idx = self.cboFileFormat.findText(filt)
123123
if idx < 0:

‎src/app/qgsattributeactiondialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ void QgsAttributeActionDialog::addDefaultActions()
306306
{
307307
int pos = 0;
308308
insertRow( pos++, QgsAction::Generic, tr( "Echo attribute's value" ), QStringLiteral( "echo \"[% \"MY_FIELD\" %]\"" ), QLatin1String( "" ), true, tr( "Attribute Value" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
309-
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() );
309+
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() );
310310
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() );
311311
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() );
312312
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() );

‎src/core/processing/qgsprocessingutils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ void parseDestinationString( QString &destination, QString &providerKey, QString
322322

323323
if ( format.isEmpty() )
324324
{
325-
format = QStringLiteral( "ESRI Shapefile" );
326-
destination = destination + QStringLiteral( ".shp" );
325+
format = QStringLiteral( "GPKG" );
326+
destination = destination + QStringLiteral( ".gpkg" );
327327
}
328328

329329
options.insert( QStringLiteral( "driverName" ), format );

‎src/core/qgsvectorfilewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2306,7 +2306,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe
23062306
}
23072307

23082308
QgsVectorFileWriter::SaveVectorOptions::SaveVectorOptions()
2309-
: driverName( QStringLiteral( "ESRI Shapefile" ) )
2309+
: driverName( QStringLiteral( "GPKG" ) )
23102310
{
23112311
}
23122312

‎src/core/qgsvectorfilewriter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class CORE_EXPORT QgsVectorFileWriter : public QgsFeatureSink
288288
const QString &fileName,
289289
const QString &fileEncoding,
290290
const QgsCoordinateReferenceSystem &destCRS = QgsCoordinateReferenceSystem(),
291-
const QString &driverName = "ESRI Shapefile",
291+
const QString &driverName = "GPKG",
292292
bool onlySelected = false,
293293
QString *errorMessage SIP_OUT = nullptr,
294294
const QStringList &datasourceOptions = QStringList(),
@@ -334,7 +334,7 @@ class CORE_EXPORT QgsVectorFileWriter : public QgsFeatureSink
334334
const QString &fileName,
335335
const QString &fileEncoding,
336336
const QgsCoordinateTransform &ct,
337-
const QString &driverName = "ESRI Shapefile",
337+
const QString &driverName = "GPKG",
338338
bool onlySelected = false,
339339
QString *errorMessage SIP_OUT = nullptr,
340340
const QStringList &datasourceOptions = QStringList(),
@@ -450,7 +450,7 @@ class CORE_EXPORT QgsVectorFileWriter : public QgsFeatureSink
450450
const QgsFields &fields,
451451
QgsWkbTypes::Type geometryType,
452452
const QgsCoordinateReferenceSystem &srs = QgsCoordinateReferenceSystem(),
453-
const QString &driverName = "ESRI Shapefile",
453+
const QString &driverName = "GPKG",
454454
const QStringList &datasourceOptions = QStringList(),
455455
const QStringList &layerOptions = QStringList(),
456456
QString *newFilename = nullptr,

‎src/gui/ogr/qgsvectorlayersaveasdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void QgsVectorLayerSaveAsDialog::setup()
9494
mFormatComboBox->addItem( it.key(), it.value() );
9595
}
9696

97-
QString format = settings.value( QStringLiteral( "UI/lastVectorFormat" ), "ESRI Shapefile" ).toString();
97+
QString format = settings.value( QStringLiteral( "UI/lastVectorFormat" ), "GPKG" ).toString();
9898
mFormatComboBox->setCurrentIndex( mFormatComboBox->findData( format ) );
9999
mFormatComboBox->blockSignals( false );
100100

‎src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void QgsGeometryCheckerResultTab::exportErrors()
227227
initialdir = dir.absolutePath();
228228
}
229229

230-
QString file = QFileDialog::getSaveFileName( this, tr( "Select Output File" ), initialdir, tr( "ESRI Shapefile (*.shp);;" ) );
230+
QString file = QFileDialog::getSaveFileName( this, tr( "Select Output File" ), initialdir, tr( "GeoPackage (*.gpkg);;" ) );
231231
if ( file.isEmpty() )
232232
{
233233
return;

‎src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void QgsGeometryCheckerSetupTab::validateInput()
130130

131131
void QgsGeometryCheckerSetupTab::selectOutputFile()
132132
{
133-
QString filterString = QgsVectorFileWriter::filterForDriver( QStringLiteral( "ESRI Shapefile" ) );
133+
QString filterString = QgsVectorFileWriter::filterForDriver( QStringLiteral( "GPKG" ) );
134134
QMap<QString, QString> filterFormatMap = QgsVectorFileWriter::supportedFiltersAndFormats();
135135
Q_FOREACH ( const QString &filter, filterFormatMap.keys() )
136136
{

‎src/providers/ogr/qgsogrprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ QgsVectorLayerExporter::ExportError QgsOgrProvider::createEmptyLayer( const QStr
217217
const QMap<QString, QVariant> *options )
218218
{
219219
QString encoding;
220-
QString driverName = QStringLiteral( "ESRI Shapefile" );
220+
QString driverName = QStringLiteral( "GPKG" );
221221
QStringList dsOptions, layerOptions;
222222
QString layerName;
223223

‎tests/src/analysis/testqgsprocessing.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ void TestQgsProcessing::initTestCase()
376376
void TestQgsProcessing::cleanupTestCase()
377377
{
378378
QFile::remove( QDir::tempPath() + "/create_feature_sink.tab" );
379-
QgsVectorFileWriter::deleteShapeFile( QDir::tempPath() + "/create_feature_sink2.shp" );
379+
QgsVectorFileWriter::deleteShapeFile( QDir::tempPath() + "/create_feature_sink2.gpkg" );
380380

381381
QgsApplication::exitQgis();
382382
}
@@ -1211,7 +1211,7 @@ void TestQgsProcessing::createFeatureSink()
12111211

12121212
// no extension, should default to shp
12131213
destination = QDir::tempPath() + "/create_feature_sink2";
1214-
prevDest = QDir::tempPath() + "/create_feature_sink2.shp";
1214+
prevDest = QDir::tempPath() + "/create_feature_sink2.gpkg";
12151215
sink.reset( QgsProcessingUtils::createFeatureSink( destination, context, fields, QgsWkbTypes::Point25D, QgsCoordinateReferenceSystem::fromEpsgId( 3111 ) ) );
12161216
QVERIFY( sink.get() );
12171217
f.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "PointZ(1 2 3)" ) ) );
@@ -1222,9 +1222,10 @@ void TestQgsProcessing::createFeatureSink()
12221222
layer = qobject_cast< QgsVectorLayer *>( QgsProcessingUtils::mapLayerFromString( destination, context, true ) );
12231223
QCOMPARE( layer->wkbType(), QgsWkbTypes::Point25D );
12241224
QCOMPARE( layer->crs().authid(), QStringLiteral( "EPSG:3111" ) );
1225-
QCOMPARE( layer->fields().size(), 1 );
1226-
QCOMPARE( layer->fields().at( 0 ).name(), QStringLiteral( "my_field" ) );
1227-
QCOMPARE( layer->fields().at( 0 ).type(), QVariant::String );
1225+
QCOMPARE( layer->fields().size(), 2 );
1226+
QCOMPARE( layer->fields().at( 0 ).name(), QStringLiteral( "fid" ) );
1227+
QCOMPARE( layer->fields().at( 1 ).name(), QStringLiteral( "my_field" ) );
1228+
QCOMPARE( layer->fields().at( 1 ).type(), QVariant::String );
12281229
QCOMPARE( layer->featureCount(), 1L );
12291230
delete layer;
12301231
layer = nullptr;

‎tests/src/core/testqgsmaprendererjob.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void TestQgsMapRendererJob::initTestCase()
109109
QString myDataDir( TEST_DATA_DIR ); //defined in CmakeLists.txt
110110
QString myTestDataDir = myDataDir + '/';
111111
QString myTmpDir = QDir::tempPath() + '/';
112-
QString myFileName = myTmpDir + "maprender_testdata.shp";
112+
QString myFileName = myTmpDir + "maprender_testdata.gpkg";
113113
//copy over the default qml for our generated layer
114114
QString myQmlFileName = myTestDataDir + "maprender_testdata.qml";
115115
QFile::remove( myTmpDir + "maprender_testdata.qml" );
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.