Skip to content

Commit

Permalink
upgrade GDAL to 3.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Jun 14, 2024
1 parent 0dd27b2 commit a4ea051
Show file tree
Hide file tree
Showing 1,758 changed files with 104,262 additions and 47,654 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.9]
## [3.9.0]

### Added
- GDAL 3.9.0

### Changed
- All shared library symbols are now hidden on Linux, allowing to load the binary addon in a process that has loaded a different version of GDAL (on Windows this has always been possible and on maOS, while possible in theory, this particular linking mode is not supported by `node-gyp`)
Expand Down
2 changes: 1 addition & 1 deletion deps/libgdal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR/libgdal"

GDAL_VERSION=3.8.5
GDAL_VERSION=3.9.0
GDAL_VERSION_SUFFIX=
dir_gdal=./gdal
dir_formats_gyp=./gyp-formats
Expand Down
4 changes: 3 additions & 1 deletion deps/libgdal/gdal/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never

# Add line breaks
SeparateDefinitionBlocks: Always
EmptyLineBeforeAccessModifier: LogicalBlock
---
Language: Json
BasedOnStyle: llvm
3 changes: 2 additions & 1 deletion deps/libgdal/gdal/.git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,5 @@ cb5dc009cf60be71f12b2718017da4621c92c561
a11bca1150f65804c78b1f3e7ad2f0ef3e47035b
9ea22d57af187eb018a4fc84577381be0817fe95
5247bbb4b27c7bf7cd6074deeeac087c1a4144b8
d7e5c0055c176ff6e70da7aa47a29654ece08ce1
d7e5c0055c176ff6e70da7aa47a29654ece08ce1
c39127b8dca9228e728a56dd93fc8ebf7c212060
2 changes: 2 additions & 0 deletions deps/libgdal/gdal/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ repos:
third_party/|
autotest/ogr/data/|
alg/internal_libqhull/|
apps/argparse/|
frmts/gtiff/libtiff/|
frmts/gtiff/libgeotiff/|
frmts/hdf4/hdf-eos/|
Expand All @@ -51,6 +52,7 @@ repos:
frmts/pcidsk/sdk|
frmts/grib/degrib/degrib|
frmts/grib/degrib/g2clib|
port/utf8.h|
ogr/ogrsf_frmts/cad/libopencad/|
ogr/ogrsf_frmts/geojson/libjson/|
ogr/ogrsf_frmts/flatgeobuf/flatbuffers/|
Expand Down
4 changes: 2 additions & 2 deletions deps/libgdal/gdal/CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: Please cite this software using these metadata or in the CITATION file.
type: software
title: GDAL
version: 3.8.5
date-released: 2024-04-02
version: 3.9.0
date-released: 2024-05-06
doi: 10.5281/zenodo.5884351
abstract: GDAL is a translator library for raster and vector geospatial data
formats that is released under an MIT style Open Source License by the Open
Expand Down
34 changes: 5 additions & 29 deletions deps/libgdal/gdal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CMake4GDAL project is distributed under MIT license. See accompanying file LICENSE.txt.
cmake_minimum_required(VERSION 3.9...3.27)
cmake_minimum_required(VERSION 3.16...3.28)

project(gdal LANGUAGES C CXX)
include(CTest)
Expand Down Expand Up @@ -38,7 +38,7 @@ define_property(
#
# check compiler and set preferences.
if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

Expand Down Expand Up @@ -159,9 +159,9 @@ endif ()
# 4. If nothing specified, use default behavior.
#
# for example
# $ cmake -DPython_LOOKUP_VERSION=3.6.0 ..
# $ cmake -DPython_LOOKUP_VERSION=3.8.0 ..
# $ cmake -DPython_FIND_VIRTUALENV=ONLY ..
# $ cmake -DPython_ROOT=C:\Python36 ..
# $ cmake -DPython_ROOT=C:\Python38 ..
# ~~~
#
include(FeatureSummary)
Expand Down Expand Up @@ -189,34 +189,10 @@ if (Python_LOOKUP_VERSION)
find_package(Python ${Python_LOOKUP_VERSION} EXACT COMPONENTS Interpreter Development NumPy)
else ()
set(Python_FIND_STRATEGY LOCATION)
find_package(Python 3.6 COMPONENTS Interpreter Development NumPy)
find_package(Python 3.8 COMPONENTS Interpreter Development NumPy)
endif ()
set_package_properties(Python PROPERTIES PURPOSE "SWIG_PYTHON: Python binding")

if (NOT Python_FOUND AND ${CMAKE_VERSION} VERSION_LESS "3.12.0")
# On Ubuntu 18.04 with Python 3.6, the backported FindPython package we have in cmake/modules/3.16 doesn't manage to
# find automatically Python (we can make it work by manually setting -DPython_LOOKUP_VERSION=3.6.9
# -DPython_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so
# -DPython_NumPy_INCLUDE_DIR=/usr/lib/python3/dist-packages/numpy/core/include/numpy ) but this is a bit painful. So
# use the deprecated method (since CMake 3.12), which works out of the box in that situation.
find_package(PythonInterp)
find_package(PythonLibs)
if (PYTHONINTERP_FOUND AND "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" VERSION_LESS "3.6")
set(PYTHONINTERP_FOUND FALSE)
set(PYTHONLIBS_FOUND FALSE)
endif()
if (PYTHONINTERP_FOUND)
set(Python_Interpreter_FOUND TRUE)
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
set(Python_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
set(Python_VERSION_MINOR ${PYTHON_VERSION_MINOR})
endif ()
if (PYTHONLIBS_FOUND)
set(Python_Development_FOUND TRUE)
set(Python_LIBRARIES ${PYTHON_LIBRARIES})
set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
endif ()
endif ()
if (Python_Interpreter_FOUND)
file(
GENERATE
Expand Down
2 changes: 1 addition & 1 deletion deps/libgdal/gdal/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8.5
3.9.0
4 changes: 1 addition & 3 deletions deps/libgdal/gdal/alg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ add_library(
gdalwarpkernel.cpp
gdalwarpoperation.cpp
llrasterize.cpp
los.cpp
polygonize.cpp
polygonize_polygonizer_impl.cpp
rasterfill.cpp
Expand All @@ -54,9 +55,6 @@ target_include_directories(
$<TARGET_PROPERTY:gdal_vrt,SOURCE_DIR> $<TARGET_PROPERTY:gdal_MEM,SOURCE_DIR>)
set_property(TARGET alg PROPERTY POSITION_INDEPENDENT_CODE ${GDAL_OBJECT_LIBRARIES_POSITION_INDEPENDENT_CODE})
target_sources(${GDAL_LIB_TARGET_NAME} PRIVATE $<TARGET_OBJECTS:alg>)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)
set_property(SOURCE gdaldither.cpp gdalmediancut.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
endif ()

if (GDAL_USE_GEOS)
target_compile_definitions(alg PRIVATE -DHAVE_GEOS=1)
Expand Down
62 changes: 49 additions & 13 deletions deps/libgdal/gdal/alg/contour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct PolygonContourWriter
CPL_DISALLOW_COPY_ASSIGN(PolygonContourWriter)

explicit PolygonContourWriter(OGRContourWriterInfo *poInfo, double minLevel)
: poInfo_(poInfo), previousLevel_(minLevel)
: poInfo_(poInfo), currentLevel_(minLevel)
{
}

Expand All @@ -128,6 +128,7 @@ struct PolygonContourWriter
currentGeometry_.reset(new OGRMultiPolygon());
currentLevel_ = level;
}

void endPolygon()
{
if (currentPart_)
Expand Down Expand Up @@ -160,6 +161,7 @@ struct PolygonContourWriter
currentPart_ = new OGRPolygon();
currentPart_->addRingDirectly(poNewRing);
}

void addInteriorRing(const marching_squares::LineString &ring)
{
OGRLinearRing *poNewRing = new OGRLinearRing();
Expand All @@ -173,8 +175,8 @@ struct PolygonContourWriter
std::unique_ptr<OGRMultiPolygon> currentGeometry_ = {};
OGRPolygon *currentPart_ = nullptr;
OGRContourWriterInfo *poInfo_ = nullptr;
double currentLevel_ = 0;
double previousLevel_;
double currentLevel_;
double previousLevel_ = 0;
};

struct GDALRingAppender
Expand Down Expand Up @@ -580,13 +582,19 @@ CPLErr GDALContourGenerateEx(GDALRasterBandH hBand, void *hLayer,
opt = CSLFetchNameValue(options, "FIXED_LEVELS");
if (opt)
{
char **values = CSLTokenizeStringComplex(opt, ",", FALSE, FALSE);
fixedLevels.resize(CSLCount(values));
const CPLStringList aosLevels(
CSLTokenizeStringComplex(opt, ",", FALSE, FALSE));
fixedLevels.resize(aosLevels.size());
for (size_t i = 0; i < fixedLevels.size(); i++)
{
fixedLevels[i] = CPLAtof(values[i]);
fixedLevels[i] = CPLAtof(aosLevels[i]);
if (i > 0 && !(fixedLevels[i] >= fixedLevels[i - 1]))
{
CPLError(CE_Failure, CPLE_AppDefined,
"FIXED_LEVELS should be strictly increasing");
return CE_Failure;
}
}
CSLDestroy(values);
}

bool useNoData = false;
Expand Down Expand Up @@ -659,16 +667,44 @@ CPLErr GDALContourGenerateEx(GDALRasterBandH hBand, void *hLayer,
{
if (polygonize)
{
int bSuccess;
PolygonContourWriter w(&oCWI,
GDALGetRasterMinimum(hBand, &bSuccess));
int bSuccessMin = FALSE;
double dfMinimum = GDALGetRasterMinimum(hBand, &bSuccessMin);
int bSuccessMax = FALSE;
double dfMaximum = GDALGetRasterMaximum(hBand, &bSuccessMax);
if ((!bSuccessMin || !bSuccessMax) && !fixedLevels.empty())
{
double adfMinMax[2];
if (GDALComputeRasterMinMax(hBand, false, adfMinMax) == CE_None)
{
dfMinimum = adfMinMax[0];
dfMaximum = adfMinMax[1];
}
}
if (!fixedLevels.empty())
{
// If the minimum raster value is larger than the first requested
// level, select the requested level that is just below the
// minimum raster value
if (fixedLevels[0] < dfMinimum)
{
for (size_t i = 1; i < fixedLevels.size(); ++i)
{
if (fixedLevels[i] >= dfMinimum)
{
dfMinimum = fixedLevels[i - 1];
break;
}
}
}
}

PolygonContourWriter w(&oCWI, dfMinimum);
typedef PolygonRingAppender<PolygonContourWriter> RingAppender;
RingAppender appender(w);
if (!fixedLevels.empty())
{
FixedLevelRangeIterator levels(
&fixedLevels[0], fixedLevels.size(),
GDALGetRasterMaximum(hBand, &bSuccess));
FixedLevelRangeIterator levels(&fixedLevels[0],
fixedLevels.size(), dfMaximum);
SegmentMerger<RingAppender, FixedLevelRangeIterator> writer(
appender, levels, /* polygonize */ true);
ContourGeneratorFromRaster<decltype(writer),
Expand Down
2 changes: 0 additions & 2 deletions deps/libgdal/gdal/alg/delaunay.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
#include <ctype.h>
#include <math.h>

CPL_CVSID("$Id$")

#if defined(INTERNAL_QHULL) || defined(EXTERNAL_QHULL)
#define HAVE_INTERNAL_OR_EXTERNAL_QHULL 1
#endif
Expand Down
8 changes: 8 additions & 0 deletions deps/libgdal/gdal/alg/gdal_alg.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ typedef struct
void *(*pfnCreateSimilar)(void *pTransformerArg, double dfSrcRatioX,
double dfSrcRatioY);
} GDALTransformerInfo;

/*! @endcond */

/*! @cond Doxygen_Suppress */
Expand Down Expand Up @@ -257,6 +258,8 @@ GDALSuggestedWarpOutput(GDALDatasetH hSrcDS, GDALTransformerFunc pfnTransformer,

/** Flag for GDALSuggestedWarpOutput2() to ask to round-up output size */
#define GDAL_SWO_ROUND_UP_SIZE 0x1
/** Flag for GDALSuggestedWarpOutput2() to ask to force square pixels */
#define GDAL_SWO_FORCE_SQUARE_PIXEL 0x2

CPLErr CPL_DLL CPL_STDCALL GDALSuggestedWarpOutput2(
GDALDatasetH hSrcDS, GDALTransformerFunc pfnTransformer,
Expand Down Expand Up @@ -354,6 +357,11 @@ GDALDatasetH CPL_DLL GDALViewshedGenerate(
void *pProgressArg, GDALViewshedOutputType heightMode,
CSLConstList papszExtraOptions);

bool CPL_DLL GDALIsLineOfSightVisible(
const GDALRasterBandH, const int xA, const int yA, const double zA,
const int xB, const int yB, const double zB, int *pnxTerrainIntersection,
int *pnyTerrainIntersection, CSLConstList papszOptions);

/************************************************************************/
/* Rasterizer API - geometries burned into GDAL raster. */
/************************************************************************/
Expand Down
71 changes: 71 additions & 0 deletions deps/libgdal/gdal/alg/gdal_alg_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ typedef struct
GSpacing nLineSpace;
GSpacing nBandSpace;
GDALDataType eBurnValueType;

union
{
const std::int64_t *int64_values;
const double *double_values;
} burnValues;

GDALBurnValueSrc eBurnValueSource;
GDALRasterMergeAlg eMergeAlg;
bool bFillSetVisitedPoints;
Expand Down Expand Up @@ -167,6 +169,13 @@ struct IntEqualityTest
typedef GDALRasterPolygonEnumeratorT<std::int64_t, IntEqualityTest>
GDALRasterPolygonEnumerator;

constexpr const char *GDAL_APPROX_TRANSFORMER_CLASS_NAME =
"GDALApproxTransformer";
constexpr const char *GDAL_GEN_IMG_TRANSFORMER_CLASS_NAME =
"GDALGenImgProjTransformer";

bool GDALIsTransformer(void *hTransformerArg, const char *pszClassName);

typedef void *(*GDALTransformDeserializeFunc)(CPLXMLNode *psTree);

void CPL_DLL *GDALRegisterTransformDeserializer(
Expand Down Expand Up @@ -251,6 +260,68 @@ typedef struct

} GDALGeoLocTransformInfo;

/************************************************************************/
/* ==================================================================== */
/* GDALReprojectionTransformer */
/* ==================================================================== */
/************************************************************************/

struct GDALReprojectionTransformInfo
{
GDALTransformerInfo sTI;
char **papszOptions = nullptr;
double dfTime = 0.0;

OGRCoordinateTransformation *poForwardTransform = nullptr;
OGRCoordinateTransformation *poReverseTransform = nullptr;

GDALReprojectionTransformInfo() : sTI()
{
memset(&sTI, 0, sizeof(sTI));
}

GDALReprojectionTransformInfo(const GDALReprojectionTransformInfo &) =
delete;
GDALReprojectionTransformInfo &
operator=(const GDALReprojectionTransformInfo &) = delete;
};

/************************************************************************/
/* ==================================================================== */
/* GDALGenImgProjTransformer */
/* ==================================================================== */
/************************************************************************/

typedef struct
{

GDALTransformerInfo sTI;

double adfSrcGeoTransform[6];
double adfSrcInvGeoTransform[6];

void *pSrcTransformArg;
GDALTransformerFunc pSrcTransformer;

void *pReprojectArg;
GDALTransformerFunc pReproject;

double adfDstGeoTransform[6];
double adfDstInvGeoTransform[6];

void *pDstTransformArg;
GDALTransformerFunc pDstTransformer;

// Memorize the value of the CHECK_WITH_INVERT_PROJ at the time we
// instantiated the object, to be able to decide if
// GDALRefreshGenImgProjTransformer() must do something or not.
bool bCheckWithInvertPROJ;

// Set to TRUE when the transformation pipline is a custom one.
bool bHasCustomTransformationPipeline;

} GDALGenImgProjTransformInfo;

/************************************************************************/
/* Color table related */
/************************************************************************/
Expand Down
Loading

0 comments on commit a4ea051

Please sign in to comment.