Skip to content

Commit 21ad4ed

Browse files
authoredJan 10, 2017
Merge pull request #3940 from nyalldawson/gdal2
Bump minimum GDAL version to 2.0, remove old version #ifdefs
2 parents 313ec55 + 4b8c5be commit 21ad4ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+110
-688
lines changed
 

‎cmake/FindGDAL.cmake

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,9 @@ ELSE(WIN32)
6161
ENDIF (NOT GDAL_VERSION)
6262
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}")
6363
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
64-
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
65-
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
66-
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
67-
68-
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
69-
MESSAGE (WARNING "GDAL version is too old (${GDAL_VERSION}) to support GeoPackage. 1.11.0 or higher is recommended.")
70-
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
64+
IF (GDAL_VERSION_MAJOR LESS 2)
65+
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.0 or higher.")
66+
ENDIF (GDAL_VERSION_MAJOR LESS 2)
7167

7268
ENDIF (GDAL_LIBRARY)
7369
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
@@ -105,14 +101,10 @@ ELSE(WIN32)
105101

106102
# check for gdal version
107103
# version 1.2.5 is known NOT to be supported (missing CPL_STDCALL macro)
108-
# According to INSTALL, 1.4.0+ is required
109-
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
110-
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
111-
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
112-
113-
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
114-
MESSAGE (WARNING "GDAL version is too old (${GDAL_VERSION}) to support GeoPackage. 1.11.0 or higher is recommended.")
115-
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
104+
# According to INSTALL, 2.0+ is required
105+
IF (GDAL_VERSION_MAJOR LESS 2)
106+
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.0 or higher.")
107+
ENDIF (GDAL_VERSION_MAJOR LESS 2)
116108

117109
# set INCLUDE_DIR to prefix+include
118110
EXEC_PROGRAM(${GDAL_CONFIG}

‎src/analysis/raster/qgskde.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323
#define M_PI 3.14159265358979323846
2424
#endif
2525

26-
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
27-
#define TO8F(x) (x).toUtf8().constData()
28-
#else
29-
#define TO8F(x) QFile::encodeName( x ).constData()
30-
#endif
31-
3226
QgsKernelDensityEstimation::QgsKernelDensityEstimation( const QgsKernelDensityEstimation::Parameters& parameters, const QString& outputFile, const QString& outputFormat )
3327
: mInputLayer( parameters.vectorLayer )
3428
, mOutputFile( outputFile )
@@ -99,7 +93,7 @@ QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::prepare()
9993
return FileCreationError;
10094

10195
// open the raster in GA_Update mode
102-
mDatasetH = GDALOpen( TO8F( mOutputFile ), GA_Update );
96+
mDatasetH = GDALOpen( mOutputFile.toUtf8().constData(), GA_Update );
10397
if ( !mDatasetH )
10498
return FileCreationError;
10599
mRasterBandH = GDALGetRasterBand( mDatasetH, 1 );

0 commit comments

Comments
 (0)
Please sign in to comment.