mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-07 00:03:52 -05:00
Bump minimum GDAL version to 3.2
This commit is contained in:
parent
01905bfd8c
commit
c517d802ed
@ -105,7 +105,7 @@ Required build dependencies:
|
||||
* Sqlite3 >= 3.0.0
|
||||
* SpatiaLite >= 4.2.0
|
||||
* libspatialindex
|
||||
* GDAL/OGR >= 3.0.0
|
||||
* GDAL/OGR >= 3.2.0
|
||||
* Qwt >= 5.0 & (< 6.1 with internal QwtPolar)
|
||||
* expat >= 1.95
|
||||
* QScintilla2
|
||||
|
||||
@ -64,11 +64,11 @@ ELSE(WIN32)
|
||||
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}")
|
||||
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
|
||||
IF (GDAL_VERSION_MAJOR LESS 3)
|
||||
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 3.0 or higher.")
|
||||
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 3.2 or higher.")
|
||||
ENDIF (GDAL_VERSION_MAJOR LESS 3)
|
||||
#IF ( (GDAL_VERSION_MAJOR EQUAL 2) AND (GDAL_VERSION_MINOR LESS 1) )
|
||||
# MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.1 or higher.")
|
||||
#ENDIF( (GDAL_VERSION_MAJOR EQUAL 2) AND (GDAL_VERSION_MINOR LESS 1) )
|
||||
IF ( (GDAL_VERSION_MAJOR EQUAL 3) AND (GDAL_VERSION_MINOR LESS 2) )
|
||||
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 3.2 or higher.")
|
||||
ENDIF( (GDAL_VERSION_MAJOR EQUAL 3) AND (GDAL_VERSION_MINOR LESS 2) )
|
||||
|
||||
ENDIF (GDAL_LIBRARY)
|
||||
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
|
||||
|
||||
@ -773,13 +773,11 @@ void QgsOgrProvider::loadFields()
|
||||
width, prec, QString(), varSubType
|
||||
);
|
||||
|
||||
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,2,0)
|
||||
const QString alias = textEncoding()->toUnicode( OGR_Fld_GetAlternativeNameRef( fldDef ) );
|
||||
if ( !alias.isEmpty() )
|
||||
{
|
||||
newField.setAlias( alias );
|
||||
}
|
||||
#endif
|
||||
|
||||
// check if field is nullable
|
||||
bool nullable = OGR_Fld_IsNullable( fldDef );
|
||||
@ -3563,14 +3561,12 @@ void QgsOgrProvider::open( OpenMode mode )
|
||||
}
|
||||
|
||||
QStringList options( mOpenOptions );
|
||||
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,1,0)
|
||||
// assume trusted data to get more speed
|
||||
if ( mGDALDriverName == QLatin1String( "FlatGeobuf" ) &&
|
||||
!options.contains( QStringLiteral( "VERIFY_BUFFERS=YES" ) ) )
|
||||
{
|
||||
options << QStringLiteral( "VERIFY_BUFFERS=NO" );
|
||||
}
|
||||
#endif
|
||||
|
||||
// try to open read-only
|
||||
if ( !mLayerName.isNull() )
|
||||
@ -3598,13 +3594,9 @@ void QgsOgrProvider::open( OpenMode mode )
|
||||
{
|
||||
// determine encoding from shapefile cpg or LDID information, if possible
|
||||
QString shpEncoding;
|
||||
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,1,0)
|
||||
shpEncoding = mOgrLayer->GetMetadataItem( QStringLiteral( "ENCODING_FROM_CPG" ), QStringLiteral( "SHAPEFILE" ) );
|
||||
if ( shpEncoding.isEmpty() )
|
||||
shpEncoding = mOgrLayer->GetMetadataItem( QStringLiteral( "ENCODING_FROM_LDID" ), QStringLiteral( "SHAPEFILE" ) );
|
||||
#else
|
||||
shpEncoding = QgsOgrUtils::readShapefileEncoding( mFilePath );
|
||||
#endif
|
||||
|
||||
if ( !shpEncoding.isEmpty() )
|
||||
setEncoding( shpEncoding );
|
||||
|
||||
@ -269,14 +269,12 @@ QString createFilters( const QString &type )
|
||||
if ( !sDirectoryExtensions.contains( QStringLiteral( "gdb" ) ) )
|
||||
sDirectoryExtensions << QStringLiteral( "gdb" );
|
||||
}
|
||||
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,1,0)
|
||||
else if ( driverName.startsWith( QLatin1String( "FlatGeobuf" ) ) )
|
||||
{
|
||||
sProtocolDrivers += QLatin1String( "FlatGeobuf;" );
|
||||
sFileFilters += createFileFilter_( QObject::tr( "FlatGeobuf" ), QStringLiteral( "*.fgb" ) );
|
||||
sExtensions << QStringLiteral( "fgb" );
|
||||
}
|
||||
#endif
|
||||
else if ( driverName.startsWith( QLatin1String( "PGeo" ) ) )
|
||||
{
|
||||
sDatabaseDrivers += QObject::tr( "ESRI Personal GeoDatabase" ) + ",PGeo;";
|
||||
@ -1286,18 +1284,6 @@ void QgsOgrProviderUtils::GDALCloseWrapper( GDALDatasetH hDS )
|
||||
GDALClose( hDS );
|
||||
}
|
||||
}
|
||||
|
||||
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,1,0) && GDAL_VERSION_NUM <= GDAL_COMPUTE_VERSION(3,1,3)
|
||||
else if ( mGDALDriverName == QLatin1String( "XLSX" ) ||
|
||||
mGDALDriverName == QLatin1String( "ODS" ) )
|
||||
{
|
||||
// Workaround bug in GDAL 3.1.0 to 3.1.3 that creates XLSX and ODS files incompatible with LibreOffice due to use of ZIP64
|
||||
CPLSetThreadLocalConfigOption( "CPL_CREATE_ZIP64", "NO" );
|
||||
GDALClose( hDS );
|
||||
CPLSetThreadLocalConfigOption( "CPL_CREATE_ZIP64", nullptr );
|
||||
}
|
||||
#endif
|
||||
|
||||
else
|
||||
{
|
||||
GDALClose( hDS );
|
||||
@ -3088,24 +3074,7 @@ OGRErr QgsOgrLayer::SyncToDisk()
|
||||
{
|
||||
QMutexLocker locker( &ds->mutex );
|
||||
|
||||
OGRErr eErr;
|
||||
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,1,0) && GDAL_VERSION_NUM <= GDAL_COMPUTE_VERSION(3,1,3)
|
||||
// Workaround bug in GDAL 3.1.0 to 3.1.3 that creates XLSX and ODS files incompatible with LibreOffice due to use of ZIP64
|
||||
QString drvName = GDALGetDriverShortName( GDALGetDatasetDriver( ds->hDS ) );
|
||||
if ( drvName == QLatin1String( "XLSX" ) ||
|
||||
drvName == QLatin1String( "ODS" ) )
|
||||
{
|
||||
CPLSetThreadLocalConfigOption( "CPL_CREATE_ZIP64", "NO" );
|
||||
eErr = OGR_L_SyncToDisk( hLayer );
|
||||
CPLSetThreadLocalConfigOption( "CPL_CREATE_ZIP64", nullptr );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
eErr = OGR_L_SyncToDisk( hLayer );
|
||||
}
|
||||
|
||||
return eErr;
|
||||
return OGR_L_SyncToDisk( hLayer );
|
||||
}
|
||||
|
||||
void QgsOgrLayer::ExecuteSQLNoReturn( const QByteArray &sql )
|
||||
|
||||
@ -20,22 +20,6 @@
|
||||
#include "cpl_http.h"
|
||||
#include "gdal.h"
|
||||
|
||||
#if GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(3,2,0)
|
||||
|
||||
QgsCPLHTTPFetchOverrider::QgsCPLHTTPFetchOverrider( const QString &authCfg, QgsFeedback *feedback )
|
||||
{
|
||||
Q_UNUSED( authCfg );
|
||||
Q_UNUSED( feedback );
|
||||
Q_UNUSED( mAuthCfg );
|
||||
Q_UNUSED( mFeedback );
|
||||
}
|
||||
|
||||
QgsCPLHTTPFetchOverrider::~QgsCPLHTTPFetchOverrider()
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
QgsCPLHTTPFetchOverrider::QgsCPLHTTPFetchOverrider( const QString &authCfg, QgsFeedback *feedback ):
|
||||
mAuthCfg( authCfg ),
|
||||
mFeedback( feedback )
|
||||
@ -200,8 +184,6 @@ CPLHTTPResult *QgsCPLHTTPFetchOverrider::callback( const char *pszURL,
|
||||
return psResult;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void QgsCPLHTTPFetchOverrider::setAttribute( QNetworkRequest::Attribute code, const QVariant &value )
|
||||
{
|
||||
mAttributes[code] = value;
|
||||
|
||||
@ -328,148 +328,6 @@ QString QgsGdalUtils::validateCreationOptionsFormat( const QStringList &createOp
|
||||
return QString();
|
||||
}
|
||||
|
||||
#if GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(3,2,0)
|
||||
|
||||
GDALDatasetH GDALAutoCreateWarpedVRTEx( GDALDatasetH hSrcDS, const char *pszSrcWKT, const char *pszDstWKT, GDALResampleAlg eResampleAlg,
|
||||
double dfMaxError, const GDALWarpOptions *psOptionsIn, char **papszTransformerOptions )
|
||||
{
|
||||
VALIDATE_POINTER1( hSrcDS, "GDALAutoCreateWarpedVRT", nullptr );
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Populate the warp options. */
|
||||
/* -------------------------------------------------------------------- */
|
||||
GDALWarpOptions *psWO = nullptr;
|
||||
if ( psOptionsIn != nullptr )
|
||||
psWO = GDALCloneWarpOptions( psOptionsIn );
|
||||
else
|
||||
psWO = GDALCreateWarpOptions();
|
||||
|
||||
psWO->eResampleAlg = eResampleAlg;
|
||||
|
||||
psWO->hSrcDS = hSrcDS;
|
||||
|
||||
GDALWarpInitDefaultBandMapping( psWO, GDALGetRasterCount( hSrcDS ) );
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Setup no data values */
|
||||
/* -------------------------------------------------------------------- */
|
||||
for ( int i = 0; i < psWO->nBandCount; i++ )
|
||||
{
|
||||
GDALRasterBandH rasterBand = GDALGetRasterBand( psWO->hSrcDS, psWO->panSrcBands[i] );
|
||||
|
||||
int hasNoDataValue;
|
||||
double noDataValue = GDALGetRasterNoDataValue( rasterBand, &hasNoDataValue );
|
||||
|
||||
if ( hasNoDataValue )
|
||||
{
|
||||
// Check if the nodata value is out of range
|
||||
int bClamped = FALSE;
|
||||
int bRounded = FALSE;
|
||||
CPL_IGNORE_RET_VAL(
|
||||
GDALAdjustValueToDataType( GDALGetRasterDataType( rasterBand ),
|
||||
noDataValue, &bClamped, &bRounded ) );
|
||||
if ( !bClamped )
|
||||
{
|
||||
GDALWarpInitNoDataReal( psWO, -1e10 );
|
||||
|
||||
psWO->padfSrcNoDataReal[i] = noDataValue;
|
||||
psWO->padfDstNoDataReal[i] = noDataValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( psWO->padfDstNoDataReal != nullptr )
|
||||
{
|
||||
if ( CSLFetchNameValue( psWO->papszWarpOptions, "INIT_DEST" ) == nullptr )
|
||||
{
|
||||
psWO->papszWarpOptions =
|
||||
CSLSetNameValue( psWO->papszWarpOptions, "INIT_DEST", "NO_DATA" );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Create the transformer. */
|
||||
/* -------------------------------------------------------------------- */
|
||||
psWO->pfnTransformer = GDALGenImgProjTransform;
|
||||
|
||||
char **papszOptions = nullptr;
|
||||
if ( pszSrcWKT != nullptr )
|
||||
papszOptions = CSLSetNameValue( papszOptions, "SRC_SRS", pszSrcWKT );
|
||||
if ( pszDstWKT != nullptr )
|
||||
papszOptions = CSLSetNameValue( papszOptions, "DST_SRS", pszDstWKT );
|
||||
papszOptions = CSLMerge( papszOptions, papszTransformerOptions );
|
||||
psWO->pTransformerArg =
|
||||
GDALCreateGenImgProjTransformer2( psWO->hSrcDS, nullptr,
|
||||
papszOptions );
|
||||
CSLDestroy( papszOptions );
|
||||
|
||||
if ( psWO->pTransformerArg == nullptr )
|
||||
{
|
||||
GDALDestroyWarpOptions( psWO );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Figure out the desired output bounds and resolution. */
|
||||
/* -------------------------------------------------------------------- */
|
||||
double adfDstGeoTransform[6] = { 0.0 };
|
||||
int nDstPixels = 0;
|
||||
int nDstLines = 0;
|
||||
CPLErr eErr =
|
||||
GDALSuggestedWarpOutput( hSrcDS, psWO->pfnTransformer,
|
||||
psWO->pTransformerArg,
|
||||
adfDstGeoTransform, &nDstPixels, &nDstLines );
|
||||
if ( eErr != CE_None )
|
||||
{
|
||||
GDALDestroyTransformer( psWO->pTransformerArg );
|
||||
GDALDestroyWarpOptions( psWO );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Update the transformer to include an output geotransform */
|
||||
/* back to pixel/line coordinates. */
|
||||
/* */
|
||||
/* -------------------------------------------------------------------- */
|
||||
GDALSetGenImgProjTransformerDstGeoTransform(
|
||||
psWO->pTransformerArg, adfDstGeoTransform );
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Do we want to apply an approximating transformation? */
|
||||
/* -------------------------------------------------------------------- */
|
||||
if ( dfMaxError > 0.0 )
|
||||
{
|
||||
psWO->pTransformerArg =
|
||||
GDALCreateApproxTransformer( psWO->pfnTransformer,
|
||||
psWO->pTransformerArg,
|
||||
dfMaxError );
|
||||
psWO->pfnTransformer = GDALApproxTransform;
|
||||
GDALApproxTransformerOwnsSubtransformer( psWO->pTransformerArg, TRUE );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Create the VRT file. */
|
||||
/* -------------------------------------------------------------------- */
|
||||
GDALDatasetH hDstDS
|
||||
= GDALCreateWarpedVRT( hSrcDS, nDstPixels, nDstLines,
|
||||
adfDstGeoTransform, psWO );
|
||||
|
||||
GDALDestroyWarpOptions( psWO );
|
||||
|
||||
if ( pszDstWKT != nullptr )
|
||||
GDALSetProjection( hDstDS, pszDstWKT );
|
||||
else if ( pszSrcWKT != nullptr )
|
||||
GDALSetProjection( hDstDS, pszSrcWKT );
|
||||
else if ( GDALGetGCPCount( hSrcDS ) > 0 )
|
||||
GDALSetProjection( hDstDS, GDALGetGCPProjection( hSrcDS ) );
|
||||
else
|
||||
GDALSetProjection( hDstDS, GDALGetProjectionRef( hSrcDS ) );
|
||||
|
||||
return hDstDS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
GDALDatasetH QgsGdalUtils::rpcAwareAutoCreateWarpedVrt(
|
||||
GDALDatasetH hSrcDS,
|
||||
const char *pszSrcWKT,
|
||||
|
||||
@ -1128,170 +1128,16 @@ QString QgsOgrUtils::readShapefileEncoding( const QString &path )
|
||||
|
||||
QString QgsOgrUtils::readShapefileEncodingFromCpg( const QString &path )
|
||||
{
|
||||
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,1,0)
|
||||
QString errCause;
|
||||
QgsOgrLayerUniquePtr layer = QgsOgrProviderUtils::getLayer( path, false, QStringList(), 0, errCause, false );
|
||||
return layer ? layer->GetMetadataItem( QStringLiteral( "ENCODING_FROM_CPG" ), QStringLiteral( "SHAPEFILE" ) ) : QString();
|
||||
#else
|
||||
if ( !QFileInfo::exists( path ) )
|
||||
return QString();
|
||||
|
||||
// first try to read cpg file, if present
|
||||
const QFileInfo fi( path );
|
||||
const QString baseName = fi.completeBaseName();
|
||||
const QString cpgPath = fi.dir().filePath( QStringLiteral( "%1.%2" ).arg( baseName, fi.suffix() == QLatin1String( "SHP" ) ? QStringLiteral( "CPG" ) : QStringLiteral( "cpg" ) ) );
|
||||
if ( QFile::exists( cpgPath ) )
|
||||
{
|
||||
QFile cpgFile( cpgPath );
|
||||
if ( cpgFile.open( QIODevice::ReadOnly ) )
|
||||
{
|
||||
QTextStream cpgStream( &cpgFile );
|
||||
const QString cpgString = cpgStream.readLine();
|
||||
cpgFile.close();
|
||||
|
||||
if ( !cpgString.isEmpty() )
|
||||
{
|
||||
// from OGRShapeLayer::ConvertCodePage
|
||||
// https://github.com/OSGeo/gdal/blob/master/gdal/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp#L342
|
||||
bool ok = false;
|
||||
int cpgCodePage = cpgString.toInt( &ok );
|
||||
if ( ok && ( ( cpgCodePage >= 437 && cpgCodePage <= 950 )
|
||||
|| ( cpgCodePage >= 1250 && cpgCodePage <= 1258 ) ) )
|
||||
{
|
||||
return QStringLiteral( "CP%1" ).arg( cpgCodePage );
|
||||
}
|
||||
else if ( cpgString.startsWith( QLatin1String( "8859" ) ) )
|
||||
{
|
||||
if ( cpgString.length() > 4 && cpgString.at( 4 ) == '-' )
|
||||
return QStringLiteral( "ISO-8859-%1" ).arg( cpgString.mid( 5 ) );
|
||||
else
|
||||
return QStringLiteral( "ISO-8859-%1" ).arg( cpgString.mid( 4 ) );
|
||||
}
|
||||
else if ( cpgString.startsWith( QLatin1String( "UTF-8" ), Qt::CaseInsensitive ) ||
|
||||
cpgString.startsWith( QLatin1String( "UTF8" ), Qt::CaseInsensitive ) )
|
||||
return QStringLiteral( "UTF-8" );
|
||||
else if ( cpgString.startsWith( QLatin1String( "ANSI 1251" ), Qt::CaseInsensitive ) )
|
||||
return QStringLiteral( "CP1251" );
|
||||
|
||||
return cpgString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString QgsOgrUtils::readShapefileEncodingFromLdid( const QString &path )
|
||||
{
|
||||
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,1,0)
|
||||
QString errCause;
|
||||
QgsOgrLayerUniquePtr layer = QgsOgrProviderUtils::getLayer( path, false, QStringList(), 0, errCause, false );
|
||||
return layer ? layer->GetMetadataItem( QStringLiteral( "ENCODING_FROM_LDID" ), QStringLiteral( "SHAPEFILE" ) ) : QString();
|
||||
#else
|
||||
// from OGRShapeLayer::ConvertCodePage
|
||||
// https://github.com/OSGeo/gdal/blob/master/gdal/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp#L342
|
||||
|
||||
if ( !QFileInfo::exists( path ) )
|
||||
return QString();
|
||||
|
||||
// first try to read cpg file, if present
|
||||
const QFileInfo fi( path );
|
||||
const QString baseName = fi.completeBaseName();
|
||||
|
||||
// fallback to LDID value, read from DBF file
|
||||
const QString dbfPath = fi.dir().filePath( QStringLiteral( "%1.%2" ).arg( baseName, fi.suffix() == QLatin1String( "SHP" ) ? QStringLiteral( "DBF" ) : QStringLiteral( "dbf" ) ) );
|
||||
if ( QFile::exists( dbfPath ) )
|
||||
{
|
||||
QFile dbfFile( dbfPath );
|
||||
if ( dbfFile.open( QIODevice::ReadOnly ) )
|
||||
{
|
||||
dbfFile.read( 29 );
|
||||
QDataStream dbfIn( &dbfFile );
|
||||
dbfIn.setByteOrder( QDataStream::LittleEndian );
|
||||
quint8 ldid;
|
||||
dbfIn >> ldid;
|
||||
dbfFile.close();
|
||||
|
||||
int nCP = -1; // Windows code page.
|
||||
|
||||
// http://www.autopark.ru/ASBProgrammerGuide/DBFSTRUC.HTM
|
||||
switch ( ldid )
|
||||
{
|
||||
case 1: nCP = 437; break;
|
||||
case 2: nCP = 850; break;
|
||||
case 3: nCP = 1252; break;
|
||||
case 4: nCP = 10000; break;
|
||||
case 8: nCP = 865; break;
|
||||
case 10: nCP = 850; break;
|
||||
case 11: nCP = 437; break;
|
||||
case 13: nCP = 437; break;
|
||||
case 14: nCP = 850; break;
|
||||
case 15: nCP = 437; break;
|
||||
case 16: nCP = 850; break;
|
||||
case 17: nCP = 437; break;
|
||||
case 18: nCP = 850; break;
|
||||
case 19: nCP = 932; break;
|
||||
case 20: nCP = 850; break;
|
||||
case 21: nCP = 437; break;
|
||||
case 22: nCP = 850; break;
|
||||
case 23: nCP = 865; break;
|
||||
case 24: nCP = 437; break;
|
||||
case 25: nCP = 437; break;
|
||||
case 26: nCP = 850; break;
|
||||
case 27: nCP = 437; break;
|
||||
case 28: nCP = 863; break;
|
||||
case 29: nCP = 850; break;
|
||||
case 31: nCP = 852; break;
|
||||
case 34: nCP = 852; break;
|
||||
case 35: nCP = 852; break;
|
||||
case 36: nCP = 860; break;
|
||||
case 37: nCP = 850; break;
|
||||
case 38: nCP = 866; break;
|
||||
case 55: nCP = 850; break;
|
||||
case 64: nCP = 852; break;
|
||||
case 77: nCP = 936; break;
|
||||
case 78: nCP = 949; break;
|
||||
case 79: nCP = 950; break;
|
||||
case 80: nCP = 874; break;
|
||||
case 87: return QStringLiteral( "ISO-8859-1" );
|
||||
case 88: nCP = 1252; break;
|
||||
case 89: nCP = 1252; break;
|
||||
case 100: nCP = 852; break;
|
||||
case 101: nCP = 866; break;
|
||||
case 102: nCP = 865; break;
|
||||
case 103: nCP = 861; break;
|
||||
case 104: nCP = 895; break;
|
||||
case 105: nCP = 620; break;
|
||||
case 106: nCP = 737; break;
|
||||
case 107: nCP = 857; break;
|
||||
case 108: nCP = 863; break;
|
||||
case 120: nCP = 950; break;
|
||||
case 121: nCP = 949; break;
|
||||
case 122: nCP = 936; break;
|
||||
case 123: nCP = 932; break;
|
||||
case 124: nCP = 874; break;
|
||||
case 134: nCP = 737; break;
|
||||
case 135: nCP = 852; break;
|
||||
case 136: nCP = 857; break;
|
||||
case 150: nCP = 10007; break;
|
||||
case 151: nCP = 10029; break;
|
||||
case 200: nCP = 1250; break;
|
||||
case 201: nCP = 1251; break;
|
||||
case 202: nCP = 1254; break;
|
||||
case 203: nCP = 1253; break;
|
||||
case 204: nCP = 1257; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if ( nCP != -1 )
|
||||
{
|
||||
return QStringLiteral( "CP%1" ).arg( nCP );
|
||||
}
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
#endif
|
||||
}
|
||||
|
||||
QVariantMap QgsOgrUtils::parseStyleString( const QString &string )
|
||||
|
||||
@ -1076,7 +1076,6 @@ class QgsVectorFileWriterMetadataContainer
|
||||
)
|
||||
);
|
||||
|
||||
#if defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,1,0)
|
||||
// FlatGeobuf
|
||||
datasetOptions.clear();
|
||||
layerOptions.clear();
|
||||
@ -1092,7 +1091,6 @@ class QgsVectorFileWriterMetadataContainer
|
||||
QStringLiteral( "UTF-8" )
|
||||
)
|
||||
);
|
||||
#endif
|
||||
|
||||
// ESRI Shapefile
|
||||
datasetOptions.clear();
|
||||
@ -2898,22 +2896,6 @@ QgsVectorFileWriter::~QgsVectorFileWriter()
|
||||
QgsDebugMsg( QStringLiteral( "Error while committing transaction on OGRLayer." ) );
|
||||
}
|
||||
}
|
||||
|
||||
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,1,0) && GDAL_VERSION_NUM <= GDAL_COMPUTE_VERSION(3,1,3)
|
||||
if ( mDS )
|
||||
{
|
||||
// Workaround bug in GDAL 3.1.0 to 3.1.3 that creates XLSX and ODS files incompatible with LibreOffice due to use of ZIP64
|
||||
QString drvName = GDALGetDriverShortName( GDALGetDatasetDriver( mDS.get() ) );
|
||||
if ( drvName == QLatin1String( "XLSX" ) ||
|
||||
drvName == QLatin1String( "ODS" ) )
|
||||
{
|
||||
CPLSetThreadLocalConfigOption( "CPL_CREATE_ZIP64", "NO" );
|
||||
mDS.reset();
|
||||
CPLSetThreadLocalConfigOption( "CPL_CREATE_ZIP64", nullptr );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
mDS.reset();
|
||||
|
||||
if ( mOgrRef )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user