Skip to content

Commit

Permalink
upgrade GDAL to 3.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Sep 13, 2023
1 parent 5c75d3d commit c582041
Show file tree
Hide file tree
Showing 53 changed files with 1,400 additions and 470 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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.7.2]

### Added
- GDAL 3.7.2

## [3.7.1] 2023-07-30

### Added
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.7.1
GDAL_VERSION=3.7.2
GDAL_VERSION_SUFFIX=
dir_gdal=./gdal
dir_formats_gyp=./gyp-formats
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.7.1
date-released: 2023-07-06
version: 3.7.2
date-released: 2023-09-05
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
2 changes: 1 addition & 1 deletion 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.23)
cmake_minimum_required(VERSION 3.9...3.27)

project(gdal LANGUAGES C CXX)
include(CTest)
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.7.1
3.7.2
24 changes: 15 additions & 9 deletions deps/libgdal/gdal/alg/gdalchecksum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ int CPL_STDCALL GDALChecksumImage(GDALRasterBandH hBand, int nXOff, int nYOff,
nChecksum = -1;
break;
}
const int nCount = bComplex ? nXSize * 2 : nXSize;
const size_t nCount = bComplex ? static_cast<size_t>(nXSize) * 2
: static_cast<size_t>(nXSize);

for (int i = 0; i < nCount; i++)
for (size_t i = 0; i < nCount; i++)
{
double dfVal = padfLineData[i];
int nVal;
Expand Down Expand Up @@ -206,15 +207,19 @@ int CPL_STDCALL GDALChecksumImage(GDALRasterBandH hBand, int nXOff, int nYOff,
iYBlock = nYBlocks;
break;
}
const int xIters = nValsPerIter * nChunkActualXSize;
const size_t xIters =
static_cast<size_t>(nValsPerIter) * nChunkActualXSize;
for (int iY = iYStart; iY < iYEnd; ++iY)
{
// Initialize iPrime so that it is consistent with a
// per full line iteration strategy
iPrime = (nValsPerIter * (iY * nXSize + iXStart)) % 11;
const int nOffset =
nValsPerIter * (iY - iYStart) * nChunkActualXSize;
for (int i = 0; i < xIters; ++i)
iPrime = (nValsPerIter *
(static_cast<int64_t>(iY) * nXSize + iXStart)) %
11;
const size_t nOffset = nValsPerIter *
static_cast<size_t>(iY - iYStart) *
nChunkActualXSize;
for (size_t i = 0; i < xIters; ++i)
{
nChecksum +=
panChunkData[nOffset + i] % anPrimes[iPrime++];
Expand Down Expand Up @@ -251,9 +256,10 @@ int CPL_STDCALL GDALChecksumImage(GDALRasterBandH hBand, int nXOff, int nYOff,
nChecksum = -1;
break;
}
const int nCount = bComplex ? nXSize * 2 : nXSize;
const size_t nCount = bComplex ? static_cast<size_t>(nXSize) * 2
: static_cast<size_t>(nXSize);

for (int i = 0; i < nCount; i++)
for (size_t i = 0; i < nCount; i++)
{
nChecksum += panLineData[i] % anPrimes[iPrime++];
if (iPrime > 10)
Expand Down
18 changes: 9 additions & 9 deletions deps/libgdal/gdal/alg/gdaltransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,23 +933,23 @@ CPLErr CPL_STDCALL GDALSuggestedWarpOutput2(GDALDatasetH hSrcDS,
pGIPTI->adfDstGeoTransform[4] == 0 &&
pGIPTI->adfDstGeoTransform[5] == 1)
{
/* --------------------------------------------------------------------
*/
/* Special case for warping using source geotransform and
* reprojection */
/* to deal with the poles. */
/* --------------------------------------------------------------------
*/
/* ------------------------------------------------------------- */
/* Special case for warping using source geotransform and */
/* reprojection to deal with the poles. */
/* ------------------------------------------------------------- */
const GDALReprojectionTransformInfo *psRTI =
static_cast<const GDALReprojectionTransformInfo *>(
pGIPTI->pReprojectArg);
const OGRSpatialReference *poSourceCRS =
psRTI->poForwardTransform->GetSourceCS();
const OGRSpatialReference *poTargetCRS =
psRTI->poForwardTransform->GetTargetCS();
if (poTargetCRS != nullptr &&
psRTI->poReverseTransform != nullptr &&
poTargetCRS->IsGeographic() &&
fabs(poTargetCRS->GetAngularUnits() -
CPLAtof(SRS_UA_DEGREE_CONV)) < 1e-9)
CPLAtof(SRS_UA_DEGREE_CONV)) < 1e-9 &&
(!poSourceCRS || !poSourceCRS->IsGeographic()))
{
bIsGeographicCoords = true;

Expand Down Expand Up @@ -1001,12 +1001,12 @@ CPLErr CPL_STDCALL GDALSuggestedWarpOutput2(GDALDatasetH hSrcDS,
pTransformArg);
psRTI = static_cast<const GDALReprojectionTransformInfo *>(
pGIPTI->pReprojectArg);
poSourceCRS = psRTI->poForwardTransform->GetSourceCS();
poTargetCRS = psRTI->poForwardTransform->GetTargetCS();
}
}

// Use TransformBounds() to handle more particular cases
const auto poSourceCRS = psRTI->poForwardTransform->GetSourceCS();
if (poSourceCRS != nullptr && poTargetCRS != nullptr &&
pGIPTI->adfSrcGeoTransform[1] != 0 &&
pGIPTI->adfSrcGeoTransform[2] == 0 &&
Expand Down
7 changes: 7 additions & 0 deletions deps/libgdal/gdal/apps/gdalinfo_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,13 @@ char *GDALInfo(GDALDatasetH hDataset, const GDALInfoOptions *psOptions)
json_object *poEPSG = json_object_new_int64(atoi(pszAuthCode));
json_object_object_add(poStac, "proj:epsg", poEPSG);
}
else
{
// Setting it to null is mandated by the
// https://github.com/stac-extensions/projection#projepsg
// when setting proj:projjson or proj:wkt2
json_object_object_add(poStac, "proj:epsg", nullptr);
}
{
// PROJJSON requires PROJ >= 6.2
CPLErrorHandlerPusher oPusher(CPLQuietErrorHandler);
Expand Down
48 changes: 19 additions & 29 deletions deps/libgdal/gdal/apps/gdalmdimtranslate_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,20 +904,7 @@ static bool TranslateArray(
}
}

auto srcDimForGetDimensionDesc(srcDim);
if (idxSliceSpec >= 0)
{
const auto &viewSpec(viewSpecs[idxSliceSpec]);
auto iParentDim = viewSpec.m_mapDimIdxToParentDimIdx[i];
if (iParentDim != static_cast<size_t>(-1))
srcDimForGetDimensionDesc = srcArrayDims[iParentDim];
}

const auto poDimDesc = GetDimensionDesc(oDimRemapper, psOptions,
srcDimForGetDimensionDesc);
if (poDimDesc == nullptr)
return false;

const auto nDimSize = srcDim->GetSize();
std::string newDimNameFullName(srcDimFullName);
std::string newDimName(srcDim->GetName());
int nIncr = 2;
Expand All @@ -927,7 +914,7 @@ static bool TranslateArray(
auto oIter2 = mapDstDimFullNames.find(osDstGroupFullName + '/' +
srcDim->GetName());
while (oIter2 != mapDstDimFullNames.end() &&
oIter2->second->GetSize() != poDimDesc->nSize)
oIter2->second->GetSize() != nDimSize)
{
newDimName = srcDim->GetName() + CPLSPrintf("_%d", nIncr);
newDimNameFullName = osDstGroupFullName + '/' + srcDim->GetName() +
Expand All @@ -936,15 +923,14 @@ static bool TranslateArray(
oIter2 = mapDstDimFullNames.find(newDimNameFullName);
}
if (oIter2 != mapDstDimFullNames.end() &&
oIter2->second->GetSize() == poDimDesc->nSize)
oIter2->second->GetSize() == nDimSize)
{
dstArrayDims.emplace_back(oIter2->second);
continue;
}

dstDim = poDstGroup->CreateDimension(newDimName, srcDim->GetType(),
srcDim->GetDirection(),
poDimDesc->nSize);
srcDim->GetDirection(), nDimSize);
if (!dstDim)
return false;
if (!srcDimFullName.empty() && srcDimFullName[0] == '/')
Expand Down Expand Up @@ -1236,20 +1222,24 @@ static bool CopyGroup(
}
}

auto attrs = poSrcGroup->GetAttributes();
for (const auto &attr : attrs)
if (!(poSrcGroup == poSrcRootGroup && psOptions->aosGroup.empty()))
{
auto dstAttr = poDstGroup->CreateAttribute(
attr->GetName(), attr->GetDimensionsSize(), attr->GetDataType());
if (!dstAttr)
auto attrs = poSrcGroup->GetAttributes();
for (const auto &attr : attrs)
{
if (!psOptions->bStrict)
continue;
return false;
auto dstAttr = poDstGroup->CreateAttribute(
attr->GetName(), attr->GetDimensionsSize(),
attr->GetDataType());
if (!dstAttr)
{
if (!psOptions->bStrict)
continue;
return false;
}
auto raw(attr->ReadAsRaw());
if (!dstAttr->Write(raw.data(), raw.size()) && !psOptions->bStrict)
return false;
}
auto raw(attr->ReadAsRaw());
if (!dstAttr->Write(raw.data(), raw.size()) && !psOptions->bStrict)
return false;
}

auto arrayNames = poSrcGroup->GetMDArrayNames();
Expand Down
67 changes: 53 additions & 14 deletions deps/libgdal/gdal/apps/ogr2ogr_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5748,17 +5748,7 @@ int LayerTranslator::Translate(OGRFeature *poFeatureIn, TargetLayerInfo *psInfo,
}
}

if (eGType != GEOMTYPE_UNCHANGED)
{
poDstGeometry = OGRGeometryFactory::forceTo(
poDstGeometry,
static_cast<OGRwkbGeometryType>(eGType));
}
else if (m_eGeomTypeConversion == GTC_PROMOTE_TO_MULTI ||
m_eGeomTypeConversion == GTC_CONVERT_TO_LINEAR ||
m_eGeomTypeConversion ==
GTC_PROMOTE_TO_MULTI_AND_CONVERT_TO_LINEAR ||
m_eGeomTypeConversion == GTC_CONVERT_TO_CURVE)
if (m_eGeomTypeConversion != GTC_DEFAULT)
{
OGRwkbGeometryType eTargetType =
poDstGeometry->getGeometryType();
Expand All @@ -5767,6 +5757,12 @@ int LayerTranslator::Translate(OGRFeature *poFeatureIn, TargetLayerInfo *psInfo,
poDstGeometry = OGRGeometryFactory::forceTo(
poDstGeometry, eTargetType);
}
else if (eGType != GEOMTYPE_UNCHANGED)
{
poDstGeometry = OGRGeometryFactory::forceTo(
poDstGeometry,
static_cast<OGRwkbGeometryType>(eGType));
}
}

poDstFeature->SetGeomFieldDirectly(iGeom, poDstGeometry);
Expand Down Expand Up @@ -6131,29 +6127,72 @@ GDALVectorTranslateOptions *GDALVectorTranslateOptionsNew(
osGeomName.resize(osGeomName.size() - 1);
}
if (EQUAL(osGeomName, "NONE"))
{
if (psOptions->eGType != GEOMTYPE_UNCHANGED)
{
CPLError(CE_Failure, CPLE_IllegalArg,
"Unsupported combination of -nlt arguments");
return nullptr;
}
psOptions->eGType = wkbNone;
}
else if (EQUAL(osGeomName, "GEOMETRY"))
{
if (psOptions->eGType != GEOMTYPE_UNCHANGED)
{
CPLError(CE_Failure, CPLE_IllegalArg,
"Unsupported combination of -nlt arguments");
return nullptr;
}
psOptions->eGType = wkbUnknown;
}
else if (EQUAL(osGeomName, "PROMOTE_TO_MULTI"))
{
if (psOptions->eGeomTypeConversion == GTC_CONVERT_TO_LINEAR)
psOptions->eGeomTypeConversion =
GTC_PROMOTE_TO_MULTI_AND_CONVERT_TO_LINEAR;
else
else if (psOptions->eGeomTypeConversion == GTC_DEFAULT)
psOptions->eGeomTypeConversion = GTC_PROMOTE_TO_MULTI;
else
{
CPLError(CE_Failure, CPLE_IllegalArg,
"Unsupported combination of -nlt arguments");
return nullptr;
}
}
else if (EQUAL(osGeomName, "CONVERT_TO_LINEAR"))
{
if (psOptions->eGeomTypeConversion == GTC_PROMOTE_TO_MULTI)
psOptions->eGeomTypeConversion =
GTC_PROMOTE_TO_MULTI_AND_CONVERT_TO_LINEAR;
else
else if (psOptions->eGeomTypeConversion == GTC_DEFAULT)
psOptions->eGeomTypeConversion = GTC_CONVERT_TO_LINEAR;
else
{
CPLError(CE_Failure, CPLE_IllegalArg,
"Unsupported combination of -nlt arguments");
return nullptr;
}
}
else if (EQUAL(osGeomName, "CONVERT_TO_CURVE"))
psOptions->eGeomTypeConversion = GTC_CONVERT_TO_CURVE;
{
if (psOptions->eGeomTypeConversion == GTC_DEFAULT)
psOptions->eGeomTypeConversion = GTC_CONVERT_TO_CURVE;
else
{
CPLError(CE_Failure, CPLE_IllegalArg,
"Unsupported combination of -nlt arguments");
return nullptr;
}
}
else
{
if (psOptions->eGType != GEOMTYPE_UNCHANGED)
{
CPLError(CE_Failure, CPLE_IllegalArg,
"Unsupported combination of -nlt arguments");
return nullptr;
}
psOptions->eGType = OGRFromOGCGeomType(osGeomName);
if (psOptions->eGType == wkbUnknown)
{
Expand Down
2 changes: 2 additions & 0 deletions deps/libgdal/gdal/apps/ogrinfo_bin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ MAIN_START(argc, argv)

if (pszGDALVectorInfoOutput)
printf("%s", pszGDALVectorInfoOutput);
else
nRet = 1;

CPLFree(pszGDALVectorInfoOutput);
}
Expand Down
5 changes: 5 additions & 0 deletions deps/libgdal/gdal/apps/ogrinfo_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,7 @@ char *GDALVectorInfo(GDALDatasetH hDataset,
Concat(osRet, psOptions->bStdoutOutput,
"layer names ignored in combination with -sql.\n");

CPLErrorReset();
OGRLayer *poResultSet = poDS->ExecuteSQL(
psOptions->osSQLStatement.c_str(),
psOptions->osGeomField.empty() ? psOptions->poSpatialFilter.get()
Expand Down Expand Up @@ -1778,6 +1779,10 @@ char *GDALVectorInfo(GDALDatasetH hDataset,

poDS->ReleaseResultSet(poResultSet);
}
else if (CPLGetLastErrorType() != CE_None)
{
return nullptr;
}
}

// coverity[tainted_data]
Expand Down
2 changes: 1 addition & 1 deletion deps/libgdal/gdal/cmake/modules/Ccache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Add "include(Ccache)" to CMakeLists.txt and enable
# using the option -D USE_CCACHE=ON

cmake_minimum_required(VERSION 3.4)
cmake_minimum_required(VERSION 3.4...3.23)


option(USE_CCACHE
Expand Down
4 changes: 2 additions & 2 deletions deps/libgdal/gdal/cmake/modules/packages/FindSPATIALITE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ mark_as_advanced(SPATIALITE_LIBRARY SPATIALITE_INCLUDE_DIR)
if(SPATIALITE_LIBRARY AND SPATIALITE_INCLUDE_DIR
AND NOT SPATIALITE_VERSION_STRING)
file(STRINGS "${SPATIALITE_INCLUDE_DIR}/spatialite.h" _spatialite_h_ver
REGEX "^[ \t]version[ \t]([0-9]+\\.[0-9]+),.*")
string(REGEX REPLACE "[ \t]version[ \t]([0-9]+\\.[0-9]+),.*" "\\1" _spatialite_h_ver ${_spatialite_h_ver})
REGEX "^[ \t]version[ \t]([0-9]+\\.[0-9]+)[,.].*")
string(REGEX REPLACE "[ \t]version[ \t]([0-9]+\\.[0-9]+)[,.].*" "\\1" _spatialite_h_ver "${_spatialite_h_ver}")
set(SPATIALITE_VERSION_STRING "${_spatialite_h_ver}")
endif()

Expand Down
Loading

0 comments on commit c582041

Please sign in to comment.