Skip to content

Commit

Permalink
[GUI] Save as vector layer dialog: add hints about using TARGET_ARCGI…
Browse files Browse the repository at this point in the history
…S_VERSION=ARCGIS_PRO_3_2_OR_LATER when needed

Fixes #58690
  • Loading branch information
rouault authored and nyalldawson committed Sep 17, 2024
1 parent 7f890f8 commit 0240c8b
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/gui/ogr/qgsvectorlayersaveasdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,57 @@ QList<QPair<QLabel *, QWidget *> > QgsVectorLayerSaveAsDialog::createControls( c

void QgsVectorLayerSaveAsDialog::accept()
{
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,9,0)
if ( format() == QLatin1String( "OpenFileGDB" ) )
{
// The OpenFileGDB driver supports 64-bit integer fields starting with GDAL 3.9,
// if selecting the TARGET_ARCGIS_VERSION=ARCGIS_PRO_3_2_OR_LATER option
bool targetAll = true;
for ( const QString &layerOption : layerOptions() )
{
if ( layerOption == QLatin1String( "TARGET_ARCGIS_VERSION=ARCGIS_PRO_3_2_OR_LATER" ) )
{
targetAll = false;
}
}
if ( targetAll )
{
for ( int i = 0; i < mLayer->fields().size(); ++i )
{
QgsField fld = mLayer->fields().at( i );
if ( fld.type() == QMetaType::Type::LongLong )
{
if ( QMessageBox::question( this,
tr( "Save Vector Layer As" ),
tr( "The layer contains at least one 64-bit integer field, which, with the current settings, can only be exported as a Real field. It could be exported as a 64-bit integer field if the TARGET_ARCGIS_VERSION layer option is set to ARCGIS_PRO_3_2_OR_LATER. Do you want to continue and export it as a Real field?" ) ) != QMessageBox::Yes )
{
return;
}
break;
}
}
}
}
else if ( format() == QLatin1String( "FileGDB" ) )
{
// The FileGDB driver based on the ESRI SDK doesn't support 64-bit integers
for ( int i = 0; i < mLayer->fields().size(); ++i )
{
QgsField fld = mLayer->fields().at( i );
if ( fld.type() == QMetaType::Type::LongLong )
{
if ( QMessageBox::question( this,
tr( "Save Vector Layer As" ),
tr( "The layer contains at least one 64-bit integer field, which cannot be exported as such when using this output driver. 64-bit integer fields could be supported by selecting the %1 format and setting its TARGET_ARCGIS_VERSION layer option to ARCGIS_PRO_3_2_OR_LATER. Do you want to continue and export it as a Real field?" ).arg( tr( "ESRI File Geodatabase" ) ) ) != QMessageBox::Yes )
{
return;
}
break;
}
}
}
#endif

if ( QFile::exists( fileName() ) )
{
QgsVectorFileWriter::EditionCapabilities caps =
Expand Down

0 comments on commit 0240c8b

Please sign in to comment.