/src/gdal/apps/gdalalg_vector.cpp
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: GDAL |
4 | | * Purpose: gdal "vector" subcommand |
5 | | * Author: Even Rouault <even dot rouault at spatialys.com> |
6 | | * |
7 | | ****************************************************************************** |
8 | | * Copyright (c) 2024, Even Rouault <even dot rouault at spatialys.com> |
9 | | * |
10 | | * SPDX-License-Identifier: MIT |
11 | | ****************************************************************************/ |
12 | | |
13 | | //! @cond Doxygen_Suppress |
14 | | |
15 | | #include "gdalalg_vector.h" |
16 | | |
17 | | #include "gdalalg_vector_info.h" |
18 | | #include "gdalalg_vector_buffer.h" |
19 | | #include "gdalalg_vector_check_geometry.h" |
20 | | #include "gdalalg_vector_check_coverage.h" |
21 | | #include "gdalalg_vector_clean_coverage.h" |
22 | | #include "gdalalg_vector_clip.h" |
23 | | #include "gdalalg_vector_combine.h" |
24 | | #include "gdalalg_vector_concat.h" |
25 | | #include "gdalalg_vector_concave_hull.h" |
26 | | #include "gdalalg_vector_convert.h" |
27 | | #include "gdalalg_vector_convex_hull.h" |
28 | | #include "gdalalg_vector_create.h" |
29 | | #include "gdalalg_vector_dissolve.h" |
30 | | #include "gdalalg_vector_edit.h" |
31 | | #include "gdalalg_vector_explode_collections.h" |
32 | | #include "gdalalg_vector_export_schema.h" |
33 | | #include "gdalalg_vector_grid.h" |
34 | | #include "gdalalg_vector_index.h" |
35 | | #include "gdalalg_vector_layer_algebra.h" |
36 | | #include "gdalalg_vector_make_point.h" |
37 | | #include "gdalalg_vector_make_valid.h" |
38 | | #include "gdalalg_vector_pipeline.h" |
39 | | #include "gdalalg_vector_rasterize.h" |
40 | | #include "gdalalg_vector_filter.h" |
41 | | #include "gdalalg_vector_partition.h" |
42 | | #include "gdalalg_vector_rename_layer.h" |
43 | | #include "gdalalg_vector_reproject.h" |
44 | | #include "gdalalg_vector_segmentize.h" |
45 | | #include "gdalalg_vector_select.h" |
46 | | #include "gdalalg_vector_set_field_type.h" |
47 | | #include "gdalalg_vector_set_geom_type.h" |
48 | | #include "gdalalg_vector_simplify.h" |
49 | | #include "gdalalg_vector_simplify_coverage.h" |
50 | | #include "gdalalg_vector_sort.h" |
51 | | #include "gdalalg_vector_sql.h" |
52 | | #include "gdalalg_vector_update.h" |
53 | | #include "gdalalg_vector_swap_xy.h" |
54 | | |
55 | | #include "gdal_priv.h" |
56 | | |
57 | | #ifndef _ |
58 | 0 | #define _(x) (x) |
59 | | #endif |
60 | | |
61 | | /************************************************************************/ |
62 | | /* GDALVectorAlgorithm */ |
63 | | /************************************************************************/ |
64 | | |
65 | | GDALVectorAlgorithm::GDALVectorAlgorithm() |
66 | 0 | : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL) |
67 | 0 | { |
68 | 0 | AddArg("drivers", 0, |
69 | 0 | _("Display vector driver list as JSON document and exit"), |
70 | 0 | &m_drivers); |
71 | |
|
72 | 0 | AddOutputStringArg(&m_output); |
73 | |
|
74 | 0 | RegisterSubAlgorithm<GDALVectorInfoAlgorithmStandalone>(); |
75 | 0 | RegisterSubAlgorithm<GDALVectorBufferAlgorithmStandalone>(); |
76 | 0 | RegisterSubAlgorithm<GDALVectorCheckCoverageAlgorithmStandalone>(); |
77 | 0 | RegisterSubAlgorithm<GDALVectorCheckGeometryAlgorithmStandalone>(); |
78 | 0 | RegisterSubAlgorithm<GDALVectorCleanCoverageAlgorithmStandalone>(); |
79 | 0 | RegisterSubAlgorithm<GDALVectorClipAlgorithmStandalone>(); |
80 | 0 | RegisterSubAlgorithm<GDALVectorCombineAlgorithmStandalone>(); |
81 | 0 | RegisterSubAlgorithm<GDALVectorConcatAlgorithmStandalone>(); |
82 | 0 | RegisterSubAlgorithm<GDALVectorConcaveHullAlgorithmStandalone>(); |
83 | 0 | RegisterSubAlgorithm<GDALVectorConvertAlgorithm>(); |
84 | 0 | RegisterSubAlgorithm<GDALVectorConvexHullAlgorithmStandalone>(); |
85 | 0 | RegisterSubAlgorithm<GDALVectorCreateAlgorithmStandalone>(); |
86 | 0 | RegisterSubAlgorithm<GDALVectorDissolveAlgorithmStandalone>(); |
87 | 0 | RegisterSubAlgorithm<GDALVectorEditAlgorithmStandalone>(); |
88 | 0 | RegisterSubAlgorithm<GDALVectorExportSchemaAlgorithmStandalone>(); |
89 | 0 | RegisterSubAlgorithm<GDALVectorExplodeCollectionsAlgorithmStandalone>(); |
90 | 0 | RegisterSubAlgorithm<GDALVectorGridAlgorithmStandalone>(); |
91 | 0 | RegisterSubAlgorithm<GDALVectorRasterizeAlgorithmStandalone>(); |
92 | 0 | RegisterSubAlgorithm<GDALVectorPipelineAlgorithm>(); |
93 | 0 | RegisterSubAlgorithm<GDALVectorFilterAlgorithmStandalone>(); |
94 | 0 | RegisterSubAlgorithm<GDALVectorIndexAlgorithm>(); |
95 | 0 | RegisterSubAlgorithm<GDALVectorLayerAlgebraAlgorithm>(); |
96 | 0 | RegisterSubAlgorithm<GDALVectorMakePointAlgorithmStandalone>(); |
97 | 0 | RegisterSubAlgorithm<GDALVectorMakeValidAlgorithmStandalone>(); |
98 | 0 | RegisterSubAlgorithm<GDALVectorPartitionAlgorithmStandalone>(); |
99 | 0 | RegisterSubAlgorithm<GDALVectorRenameLayerAlgorithmStandalone>(); |
100 | 0 | RegisterSubAlgorithm<GDALVectorReprojectAlgorithmStandalone>(); |
101 | 0 | RegisterSubAlgorithm<GDALVectorSegmentizeAlgorithmStandalone>(); |
102 | 0 | RegisterSubAlgorithm<GDALVectorSelectAlgorithmStandalone>(); |
103 | 0 | RegisterSubAlgorithm<GDALVectorSetFieldTypeAlgorithmStandalone>(); |
104 | 0 | RegisterSubAlgorithm<GDALVectorSetGeomTypeAlgorithmStandalone>(); |
105 | 0 | RegisterSubAlgorithm<GDALVectorSimplifyAlgorithmStandalone>(); |
106 | 0 | RegisterSubAlgorithm<GDALVectorSimplifyCoverageAlgorithmStandalone>(); |
107 | 0 | RegisterSubAlgorithm<GDALVectorSortAlgorithmStandalone>(); |
108 | 0 | RegisterSubAlgorithm<GDALVectorSQLAlgorithmStandalone>(); |
109 | 0 | RegisterSubAlgorithm<GDALVectorUpdateAlgorithmStandalone>(); |
110 | 0 | RegisterSubAlgorithm<GDALVectorSwapXYAlgorithmStandalone>(); |
111 | 0 | } |
112 | | |
113 | | bool GDALVectorAlgorithm::RunImpl(GDALProgressFunc, void *) |
114 | 0 | { |
115 | 0 | if (m_drivers) |
116 | 0 | { |
117 | 0 | m_output = GDALPrintDriverList(GDAL_OF_VECTOR, true); |
118 | 0 | return true; |
119 | 0 | } |
120 | 0 | else |
121 | 0 | { |
122 | 0 | CPLError(CE_Failure, CPLE_AppDefined, |
123 | 0 | "The Run() method should not be called directly on the \"gdal " |
124 | 0 | "vector\" program."); |
125 | 0 | return false; |
126 | 0 | } |
127 | 0 | } |
128 | | |
129 | | //! @endcond |