Skip to content

Commit 1f2581f

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 61fab22 + 8e39cf9 commit 1f2581f

File tree

103 files changed

+3095
-1103
lines changed

Some content is hidden

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

103 files changed

+3095
-1103
lines changed

.github/workflows/ubuntu_24.04/expected_gdalinfo_formats.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ Supported Formats: (ro:read-only, rw:read-write, +:write from scratch, u:update,
7777
PNM -raster- (rw+v): Portable Pixmap Format (netpbm) (*.pgm, *.ppm, *.pnm)
7878
DOQ1 -raster- (rov): USGS DOQ (Old Style)
7979
DOQ2 -raster- (rov): USGS DOQ (New Style)
80-
PAux -raster- (rov): PCI .aux Labelled
8180
MFF -raster- (rov): Vexcel MFF Raster (*.hdr)
8281
MFF2 -raster- (ro): Vexcel MFF2 (HKV) Raster
8382
GSC -raster- (rov): GSC Geogrid
@@ -140,6 +139,7 @@ Supported Formats: (ro:read-only, rw:read-write, +:write from scratch, u:update,
140139
CAD -raster,vector- (rovs): AutoCAD Driver (*.dwg)
141140
PLSCENES -raster,vector- (ro): Planet Labs Scenes API
142141
NGW -raster,vector- (rw+s): NextGIS Web
142+
PAux -raster- (rov): PCI .aux Labelled
143143
GenBin -raster- (rov): Generic Binary (.hdr Labelled)
144144
ENVI -raster- (rw+uv): ENVI .hdr Labelled
145145
EHdr -raster- (rw+uv): ESRI .hdr Labelled (*.bil)

.github/workflows/windows_conda_expected_gdalinfo_formats.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ Supported Formats: (ro:read-only, rw:read-write, +:write from scratch, u:update,
7979
PNM -raster- (rw+v): Portable Pixmap Format (netpbm) (*.pgm, *.ppm, *.pnm)
8080
DOQ1 -raster- (rov): USGS DOQ (Old Style)
8181
DOQ2 -raster- (rov): USGS DOQ (New Style)
82-
PAux -raster- (rov): PCI .aux Labelled
8382
MFF -raster- (rov): Vexcel MFF Raster (*.hdr)
8483
MFF2 -raster- (ro): Vexcel MFF2 (HKV) Raster
8584
GSC -raster- (rov): GSC Geogrid
@@ -140,6 +139,7 @@ Supported Formats: (ro:read-only, rw:read-write, +:write from scratch, u:update,
140139
PLSCENES -raster,vector- (ro): Planet Labs Scenes API
141140
NGW -raster,vector- (rw+s): NextGIS Web
142141
MiraMonRaster -raster- (rovs): MiraMon Raster Images (*.rel, *.img)
142+
PAux -raster- (rov): PCI .aux Labelled
143143
GenBin -raster- (rov): Generic Binary (.hdr Labelled)
144144
ENVI -raster- (rw+uv): ENVI .hdr Labelled
145145
EHdr -raster- (rw+uv): ESRI .hdr Labelled (*.bil)

alg/gdalwarpoperation.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,19 @@ int GDALWarpOperation::ValidateOptions()
437437
return FALSE;
438438
}
439439

440+
GDALRasterBandH hSrcBand =
441+
GDALGetRasterBand(psOptions->hSrcDS, psOptions->panSrcBands[0]);
442+
if (GDALGetMaskFlags(hSrcBand) == GMF_PER_DATASET &&
443+
psOptions->padfSrcNoDataReal != nullptr)
444+
{
445+
CPLError(
446+
CE_Warning, CPLE_AppDefined,
447+
"Source dataset has both a per-dataset mask band and the warper "
448+
"has been also configured with a source nodata value. Only taking "
449+
"into account the latter (i.e. ignoring the per-dataset mask "
450+
"band)");
451+
}
452+
440453
const bool bErrorOutIfEmptySourceWindow = CPLFetchBool(
441454
psOptions->papszWarpOptions, "ERROR_OUT_IF_EMPTY_SOURCE_WINDOW", true);
442455
if (!bErrorOutIfEmptySourceWindow &&
@@ -2285,7 +2298,8 @@ CPLErr GDALWarpOperation::WarpRegionToBuffer(
22852298
oWK.panUnifiedSrcValid == nullptr && psOptions->nSrcAlphaBand <= 0 &&
22862299
(GDALGetMaskFlags(hSrcBand) & GMF_PER_DATASET)
22872300
// Need to double check for -nosrcalpha case.
2288-
&& !(GDALGetMaskFlags(hSrcBand) & GMF_ALPHA) && nSrcXSize > 0 &&
2301+
&& !(GDALGetMaskFlags(hSrcBand) & GMF_ALPHA) &&
2302+
psOptions->padfSrcNoDataReal == nullptr && nSrcXSize > 0 &&
22892303
nSrcYSize > 0)
22902304

22912305
{

apps/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ target_sources(appslib PRIVATE
6262
gdalalg_raster_index.cpp
6363
gdalalg_raster_mosaic.cpp
6464
gdalalg_raster_mosaic_stack_common.cpp
65+
gdalalg_raster_neighbors.cpp
6566
gdalalg_raster_nodata_to_alpha.cpp
6667
gdalalg_raster_pipeline.cpp
6768
gdalalg_raster_pixel_info.cpp

apps/gdalalg_abstract_pipeline.cpp

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ bool GDALAbstractPipelineAlgorithm::IsWriteSpecificArgument(
7979
/************************************************************************/
8080

8181
bool GDALAbstractPipelineAlgorithm::CheckFirstAndLastStep(
82-
const std::vector<GDALPipelineStepAlgorithm *> &steps) const
82+
const std::vector<GDALPipelineStepAlgorithm *> &steps,
83+
bool forAutoComplete) const
8384
{
8485
if (m_bExpectReadStep && !steps.front()->CanBeFirstStep())
8586
{
@@ -124,6 +125,10 @@ bool GDALAbstractPipelineAlgorithm::CheckFirstAndLastStep(
124125
return false;
125126
}
126127
}
128+
129+
if (forAutoComplete)
130+
return true;
131+
127132
if (!m_bExpectWriteStep)
128133
{
129134
if (steps.back()->CanBeLastStep() && !steps.back()->CanBeMiddleStep())
@@ -693,7 +698,7 @@ bool GDALAbstractPipelineAlgorithm::ParseCommandLineArguments(
693698
std::vector<GDALPipelineStepAlgorithm *> stepAlgs;
694699
for (const auto &step : steps)
695700
stepAlgs.push_back(step.alg.get());
696-
if (!CheckFirstAndLastStep(stepAlgs))
701+
if (!CheckFirstAndLastStep(stepAlgs, forAutoComplete))
697702
return false; // CheckFirstAndLastStep emits an error
698703

699704
for (auto &step : steps)
@@ -745,7 +750,7 @@ bool GDALAbstractPipelineAlgorithm::ParseCommandLineArguments(
745750
}
746751
};
747752

748-
if (m_bExpectWriteStep)
753+
if (m_bExpectWriteStep && steps.back().alg->CanBeLastStep())
749754
{
750755
SetWriteArgFromPipeline();
751756
}
@@ -1010,6 +1015,8 @@ bool GDALAbstractPipelineAlgorithm::ParseCommandLineArguments(
10101015
if (poDS && poDS->GetLayerCount() > 0)
10111016
ret = false;
10121017
}
1018+
else if (!ret && firstStep)
1019+
ret = true;
10131020
}
10141021
}
10151022
else if (!m_bExpectReadStep &&
@@ -1061,7 +1068,8 @@ bool GDALAbstractPipelineAlgorithm::ParseCommandLineArguments(
10611068
for (auto &step : steps)
10621069
{
10631070
step.alg->m_skipValidationInParseCommandLine = true;
1064-
if (!step.alg->ParseCommandLineArguments(step.args))
1071+
if (!step.alg->ParseCommandLineArguments(step.args) &&
1072+
!forAutoComplete)
10651073
return false;
10661074
}
10671075
}
@@ -1427,6 +1435,7 @@ GDALAbstractPipelineAlgorithm::GetAutoComplete(std::vector<std::string> &args,
14271435
std::string lastStep = args[0];
14281436
std::vector<std::string> lastArgs;
14291437
bool firstStep = true;
1438+
bool foundSlowStep = false;
14301439
for (size_t i = 1; i < args.size(); ++i)
14311440
{
14321441
if (firstStep && isMixedTypePipeline &&
@@ -1464,7 +1473,12 @@ GDALAbstractPipelineAlgorithm::GetAutoComplete(std::vector<std::string> &args,
14641473
curAlg = GetStepAlg(lastStep + VECTOR_SUFFIX);
14651474
}
14661475
if (curAlg)
1476+
{
1477+
foundSlowStep =
1478+
foundSlowStep ||
1479+
!curAlg->IsNativelyStreamingCompatible();
14671480
nDatasetType = curAlg->GetOutputType();
1481+
}
14681482
}
14691483
}
14701484

@@ -1500,6 +1514,22 @@ GDALAbstractPipelineAlgorithm::GetAutoComplete(std::vector<std::string> &args,
15001514
}
15011515
else
15021516
{
1517+
if (!foundSlowStep)
1518+
{
1519+
// Try to run the pipeline so that the last step gets its
1520+
// input dataset.
1521+
CPLErrorStateBackuper oBackuper(CPLQuietErrorHandler);
1522+
GDALPipelineStepRunContext ctxt;
1523+
RunStep(ctxt);
1524+
if (!m_steps.empty() &&
1525+
m_steps.back()->GetName() == lastStep)
1526+
{
1527+
return m_steps.back()->GetAutoComplete(
1528+
lastArgs, lastWordIsComplete,
1529+
/* showAllOptions = */ false);
1530+
}
1531+
}
1532+
15031533
auto curAlg = GetStepAlg(lastStep);
15041534
if (isMixedTypePipeline && !curAlg)
15051535
{

apps/gdalalg_abstract_pipeline.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,9 @@ class GDALAbstractPipelineAlgorithm CPL_NON_FINAL
360360
// More would lead to unreadable pipelines
361361
static constexpr int MAX_NESTING_LEVEL = 3;
362362

363-
bool CheckFirstAndLastStep(
364-
const std::vector<GDALPipelineStepAlgorithm *> &steps) const;
363+
bool
364+
CheckFirstAndLastStep(const std::vector<GDALPipelineStepAlgorithm *> &steps,
365+
bool forAutoComplete) const;
365366

366367
bool ParseCommandLineArguments(const std::vector<std::string> &args,
367368
bool forAutoComplete);

apps/gdalalg_raster.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "gdalalg_raster_hillshade.h"
3131
#include "gdalalg_raster_index.h"
3232
#include "gdalalg_raster_mosaic.h"
33+
#include "gdalalg_raster_neighbors.h"
3334
#include "gdalalg_raster_nodata_to_alpha.h"
3435
#include "gdalalg_raster_overview.h"
3536
#include "gdalalg_raster_pansharpen.h"
@@ -95,6 +96,7 @@ class GDALRasterAlgorithm final : public GDALAlgorithm
9596
RegisterSubAlgorithm<GDALRasterHillshadeAlgorithmStandalone>();
9697
RegisterSubAlgorithm<GDALRasterFillNodataAlgorithmStandalone>();
9798
RegisterSubAlgorithm<GDALRasterIndexAlgorithm>();
99+
RegisterSubAlgorithm<GDALRasterNeighborsAlgorithmStandalone>();
98100
RegisterSubAlgorithm<GDALRasterOverviewAlgorithmStandalone>();
99101
RegisterSubAlgorithm<GDALRasterPipelineAlgorithm>();
100102
RegisterSubAlgorithm<GDALRasterPixelInfoAlgorithm>();

0 commit comments

Comments
 (0)