Skip to content

Commit

Permalink
Merge branch 'OSGeo:master' into hana_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrylov authored Feb 19, 2025
2 parents 61d4422 + 9acd794 commit 85411ee
Show file tree
Hide file tree
Showing 52 changed files with 2,306 additions and 531 deletions.
1 change: 1 addition & 0 deletions .github/workflows/alpine/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ RUN apk add \
py3-pyarrow-pyc \
py3-numpy \
py3-numpy-dev \
py3-numpy-tests \
py3-pip \
py3-setuptools \
python3-dev \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/alpine_32bit/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ RUN apk add \
py3-pyarrow-pyc \
py3-numpy \
py3-numpy-dev \
py3-numpy-tests \
py3-pip \
py3-setuptools \
python3-dev \
Expand Down
16 changes: 0 additions & 16 deletions alg/gdal_alg.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,6 @@ CPLErr CPL_DLL CPL_STDCALL GDALSieveFilter(
* Warp Related.
*/

/**
* Callback to transforms points.
*
* @param pTransformerArg return value from a GDALCreateXXXXTransformer() function
* @param bDstToSrc TRUE if transformation is from the destination
* (georeferenced) coordinates to pixel/line or FALSE when transforming
* from pixel/line to georeferenced coordinates.
* @param nPointCount the number of values in the x, y and z arrays.
* @param[in,out] x array containing the X values to be transformed. Must not be NULL.
* @param[in,out] y array containing the Y values to be transformed. Must not be NULL.
* @param[in,out] z array containing the Z values to be transformed. Must not be NULL.
* @param[out] panSuccess array in which a flag indicating success (TRUE) or
* failure (FALSE) of the transformation are placed. Must not be NULL.
*
* @return TRUE if all points have been successfully transformed.
*/
typedef int (*GDALTransformerFunc)(void *pTransformerArg, int bDstToSrc,
int nPointCount, double *x, double *y,
double *z, int *panSuccess);
Expand Down
45 changes: 23 additions & 22 deletions alg/gdaltransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ will be from the source coordinate system to the destination coordinate system.
@param nPointCount number of points in the x, y and z arrays.
@param x input X coordinates. Results returned in same array.
@param[in,out] x input X coordinates. Results returned in same array.
@param y input Y coordinates. Results returned in same array.
@param[in,out] y input Y coordinates. Results returned in same array.
@param z input Z coordinates. Results returned in same array.
@param[in,out] z input Z coordinates. Results returned in same array.
@param panSuccess array of ints in which success (TRUE) or failure (FALSE)
flags are returned for the translation of each point.
@param[out] panSuccess panSuccess array of ints in which success (TRUE) or failure (FALSE)
flags are returned for the translation of each point. Must not be NULL.
@return TRUE if the overall transformation succeeds (though some individual
points may have failed) or FALSE if the overall transformation fails.
@return TRUE if all points have been successfully transformed (changed in 3.11,
previously was TRUE if some points have been successfully transformed)
*/

Expand Down Expand Up @@ -524,11 +524,11 @@ CPLErr CPL_STDCALL GDALSuggestedWarpOutput2(GDALDatasetH hSrcDS,
/* -------------------------------------------------------------------- */
/* Transform them to the output coordinate system. */
/* -------------------------------------------------------------------- */
CPLTurnFailureIntoWarning(true);
pfnTransformer(pTransformArg, FALSE, nSamplePoints, padfX, padfY, padfZ,
pabSuccess);
CPLTurnFailureIntoWarning(false);

{
CPLTurnFailureIntoWarningBackuper oErrorsToWarnings{};
pfnTransformer(pTransformArg, FALSE, nSamplePoints, padfX, padfY, padfZ,
pabSuccess);
}
constexpr int SIGN_FINAL_UNINIT = -2;
constexpr int SIGN_FINAL_INVALID = 0;
int iSignDiscontinuity = SIGN_FINAL_UNINIT;
Expand Down Expand Up @@ -588,15 +588,14 @@ CPLErr CPL_STDCALL GDALSuggestedWarpOutput2(GDALDatasetH hSrcDS,
double ayTemp[2] = {padfY[i], padfY[i]};
double azTemp[2] = {padfZ[i], padfZ[i]};
int abSuccess[2] = {FALSE, FALSE};
CPLTurnFailureIntoWarning(true);
CPLTurnFailureIntoWarningBackuper oErrorsToWarnings{};
if (pfnTransformer(pTransformArg, TRUE, 2, axTemp, ayTemp,
azTemp, abSuccess) &&
fabs(axTemp[0] - axTemp[1]) < 1e-8 &&
fabs(ayTemp[0] - ayTemp[1]) < 1e-8)
{
padfX[i] = iSignDiscontinuity * 180.0;
}
CPLTurnFailureIntoWarning(false);
}
}
}
Expand All @@ -615,10 +614,11 @@ CPLErr CPL_STDCALL GDALSuggestedWarpOutput2(GDALDatasetH hSrcDS,
memcpy(padfXRevert, padfX, nSamplePoints * sizeof(double));
memcpy(padfYRevert, padfY, nSamplePoints * sizeof(double));
memcpy(padfZRevert, padfZ, nSamplePoints * sizeof(double));
CPLTurnFailureIntoWarning(true);
pfnTransformer(pTransformArg, TRUE, nSamplePoints, padfXRevert,
padfYRevert, padfZRevert, pabSuccess);
CPLTurnFailureIntoWarning(false);
{
CPLTurnFailureIntoWarningBackuper oErrorsToWarnings{};
pfnTransformer(pTransformArg, TRUE, nSamplePoints, padfXRevert,
padfYRevert, padfZRevert, pabSuccess);
}

for (int i = 0; nFailedCount == 0 && i < nSamplePoints; i++)
{
Expand Down Expand Up @@ -693,10 +693,11 @@ CPLErr CPL_STDCALL GDALSuggestedWarpOutput2(GDALDatasetH hSrcDS,

CPLAssert(nSamplePoints == nSampleMax);

CPLTurnFailureIntoWarning(true);
pfnTransformer(pTransformArg, FALSE, nSamplePoints, padfX, padfY, padfZ,
pabSuccess);
CPLTurnFailureIntoWarning(false);
{
CPLTurnFailureIntoWarningBackuper oErrorsToWarnings{};
pfnTransformer(pTransformArg, FALSE, nSamplePoints, padfX, padfY,
padfZ, pabSuccess);
}
}

/* -------------------------------------------------------------------- */
Expand Down
1 change: 1 addition & 0 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ add_library(
gdalalg_pipeline.cpp
gdalalg_raster.cpp
gdalalg_raster_info.cpp
gdalalg_raster_calc.cpp
gdalalg_raster_clip.cpp
gdalalg_raster_convert.cpp
gdalalg_raster_edit.cpp
Expand Down
2 changes: 2 additions & 0 deletions apps/gdalalg_raster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "gdalalgorithm.h"

#include "gdalalg_raster_info.h"
#include "gdalalg_raster_calc.h"
#include "gdalalg_raster_clip.h"
#include "gdalalg_raster_convert.h"
#include "gdalalg_raster_edit.h"
Expand Down Expand Up @@ -41,6 +42,7 @@ class GDALRasterAlgorithm final : public GDALAlgorithm
GDALRasterAlgorithm() : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL)
{
RegisterSubAlgorithm<GDALRasterInfoAlgorithm>();
RegisterSubAlgorithm<GDALRasterCalcAlgorithm>();
RegisterSubAlgorithm<GDALRasterConvertAlgorithm>();
RegisterSubAlgorithm<GDALRasterClipAlgorithmStandalone>();
RegisterSubAlgorithm<GDALRasterEditAlgorithmStandalone>();
Expand Down
Loading

0 comments on commit 85411ee

Please sign in to comment.