GDAL
gdalalg_vector_clean_coverage.h
1/******************************************************************************
2*
3 * Project: GDAL
4 * Purpose: "gdal vector clean-coverage"
5 * Author: Daniel Baston
6 *
7 ******************************************************************************
8 * Copyright (c) 2025, ISciences LLC
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef GDALALG_VECTOR_CLEAN_COVERAGE_INCLUDED
14#define GDALALG_VECTOR_CLEAN_COVERAGE_INCLUDED
15
16#include "gdalalg_vector_pipeline.h"
17#include "cpl_progress.h"
18
19#include <string>
20
22
23/************************************************************************/
24/* GDALVectorCleanCoverageAlgorithm */
25/************************************************************************/
26
27class GDALVectorCleanCoverageAlgorithm : public GDALVectorPipelineStepAlgorithm
28{
29 public:
30 static constexpr const char *NAME = "clean-coverage";
31 static constexpr const char *DESCRIPTION =
32 "Alter polygon boundaries to make shared edges identical, removing "
33 "gaps and overlaps";
34 static constexpr const char *HELP_URL =
35 "/programs/gdal_vector_clean_coverage.html";
36
37 explicit GDALVectorCleanCoverageAlgorithm(bool standaloneStep = false);
38
39 struct Options
40 {
41 double snappingTolerance = -1;
42 double maximumGapWidth = 0;
43 std::string mergeStrategy = "longest-border";
44 };
45
46 private:
47 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
48
49 std::string m_activeLayer{};
50
51 Options m_opts{};
52};
53
54/************************************************************************/
55/* GDALVectorCleanCoverageAlgorithmStandalone */
56/************************************************************************/
57
58class GDALVectorCleanCoverageAlgorithmStandalone final
59 : public GDALVectorCleanCoverageAlgorithm
60{
61 public:
62 GDALVectorCleanCoverageAlgorithmStandalone()
63 : GDALVectorCleanCoverageAlgorithm(/* standaloneStep = */ true)
64 {
65 }
66
67 ~GDALVectorCleanCoverageAlgorithmStandalone() override;
68};
69
71
72#endif /* GDALALG_VECTOR_CLEAN_COVERAGE_INCLUDED */