/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.h" |
32 | | #include "gdalalg_vector_explode_collections.h" |
33 | | #include "gdalalg_vector_export_schema.h" |
34 | | #include "gdalalg_vector_grid.h" |
35 | | #include "gdalalg_vector_index.h" |
36 | | #include "gdalalg_vector_layer_algebra.h" |
37 | | #include "gdalalg_vector_make_point.h" |
38 | | #include "gdalalg_vector_make_valid.h" |
39 | | #include "gdalalg_vector_pipeline.h" |
40 | | #include "gdalalg_vector_rasterize.h" |
41 | | #include "gdalalg_vector_filter.h" |
42 | | #include "gdalalg_vector_partition.h" |
43 | | #include "gdalalg_vector_rename_layer.h" |
44 | | #include "gdalalg_vector_reproject.h" |
45 | | #include "gdalalg_vector_segmentize.h" |
46 | | #include "gdalalg_vector_select.h" |
47 | | #include "gdalalg_vector_set_field_type.h" |
48 | | #include "gdalalg_vector_set_geom_type.h" |
49 | | #include "gdalalg_vector_simplify.h" |
50 | | #include "gdalalg_vector_simplify_coverage.h" |
51 | | #include "gdalalg_vector_sort.h" |
52 | | #include "gdalalg_vector_sql.h" |
53 | | #include "gdalalg_vector_update.h" |
54 | | #include "gdalalg_vector_swap_xy.h" |
55 | | |
56 | | #include "gdal_priv.h" |
57 | | |
58 | | #ifndef _ |
59 | 0 | #define _(x) (x) |
60 | | #endif |
61 | | |
62 | | /************************************************************************/ |
63 | | /* GDALVectorAlgorithm */ |
64 | | /************************************************************************/ |
65 | | |
66 | | GDALVectorAlgorithm::GDALVectorAlgorithm() |
67 | 0 | : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL) |
68 | 0 | { |
69 | 0 | AddArg("drivers", 0, |
70 | 0 | _("Display vector driver list as JSON document and exit"), |
71 | 0 | &m_drivers); |
72 | |
|
73 | 0 | AddOutputStringArg(&m_output); |
74 | |
|
75 | 0 | RegisterSubAlgorithm<GDALVectorInfoAlgorithmStandalone>(); |
76 | 0 | RegisterSubAlgorithm<GDALVectorBufferAlgorithmStandalone>(); |
77 | 0 | RegisterSubAlgorithm<GDALVectorCheckCoverageAlgorithmStandalone>(); |
78 | 0 | RegisterSubAlgorithm<GDALVectorCheckGeometryAlgorithmStandalone>(); |
79 | 0 | RegisterSubAlgorithm<GDALVectorCleanCoverageAlgorithmStandalone>(); |
80 | 0 | RegisterSubAlgorithm<GDALVectorClipAlgorithmStandalone>(); |
81 | 0 | RegisterSubAlgorithm<GDALVectorCombineAlgorithmStandalone>(); |
82 | 0 | RegisterSubAlgorithm<GDALVectorConcatAlgorithmStandalone>(); |
83 | 0 | RegisterSubAlgorithm<GDALVectorConcaveHullAlgorithmStandalone>(); |
84 | 0 | RegisterSubAlgorithm<GDALVectorConvertAlgorithm>(); |
85 | 0 | RegisterSubAlgorithm<GDALVectorConvexHullAlgorithmStandalone>(); |
86 | 0 | RegisterSubAlgorithm<GDALVectorCreateAlgorithmStandalone>(); |
87 | 0 | RegisterSubAlgorithm<GDALVectorDissolveAlgorithmStandalone>(); |
88 | 0 | RegisterSubAlgorithm<GDALVectorEditAlgorithmStandalone>(); |
89 | 0 | RegisterSubAlgorithm<GDALVectorExportSchemaAlgorithmStandalone>(); |
90 | 0 | RegisterSubAlgorithm<GDALVectorExplodeAlgorithmStandalone>(); |
91 | 0 | RegisterSubAlgorithm<GDALVectorExplodeCollectionsAlgorithmStandalone>(); |
92 | 0 | RegisterSubAlgorithm<GDALVectorGridAlgorithmStandalone>(); |
93 | 0 | RegisterSubAlgorithm<GDALVectorRasterizeAlgorithmStandalone>(); |
94 | 0 | RegisterSubAlgorithm<GDALVectorPipelineAlgorithm>(); |
95 | 0 | RegisterSubAlgorithm<GDALVectorFilterAlgorithmStandalone>(); |
96 | 0 | RegisterSubAlgorithm<GDALVectorIndexAlgorithm>(); |
97 | 0 | RegisterSubAlgorithm<GDALVectorLayerAlgebraAlgorithmStandalone>(); |
98 | 0 | RegisterSubAlgorithm<GDALVectorMakePointAlgorithmStandalone>(); |
99 | 0 | RegisterSubAlgorithm<GDALVectorMakeValidAlgorithmStandalone>(); |
100 | 0 | RegisterSubAlgorithm<GDALVectorPartitionAlgorithmStandalone>(); |
101 | 0 | RegisterSubAlgorithm<GDALVectorRenameLayerAlgorithmStandalone>(); |
102 | 0 | RegisterSubAlgorithm<GDALVectorReprojectAlgorithmStandalone>(); |
103 | 0 | RegisterSubAlgorithm<GDALVectorSegmentizeAlgorithmStandalone>(); |
104 | 0 | RegisterSubAlgorithm<GDALVectorSelectAlgorithmStandalone>(); |
105 | 0 | RegisterSubAlgorithm<GDALVectorSetFieldTypeAlgorithmStandalone>(); |
106 | 0 | RegisterSubAlgorithm<GDALVectorSetGeomTypeAlgorithmStandalone>(); |
107 | 0 | RegisterSubAlgorithm<GDALVectorSimplifyAlgorithmStandalone>(); |
108 | 0 | RegisterSubAlgorithm<GDALVectorSimplifyCoverageAlgorithmStandalone>(); |
109 | 0 | RegisterSubAlgorithm<GDALVectorSortAlgorithmStandalone>(); |
110 | 0 | RegisterSubAlgorithm<GDALVectorSQLAlgorithmStandalone>(); |
111 | 0 | RegisterSubAlgorithm<GDALVectorUpdateAlgorithmStandalone>(); |
112 | 0 | RegisterSubAlgorithm<GDALVectorSwapXYAlgorithmStandalone>(); |
113 | 0 | } |
114 | | |
115 | | bool GDALVectorAlgorithm::RunImpl(GDALProgressFunc, void *) |
116 | 0 | { |
117 | 0 | if (m_drivers) |
118 | 0 | { |
119 | 0 | m_output = GDALPrintDriverList(GDAL_OF_VECTOR, true); |
120 | 0 | return true; |
121 | 0 | } |
122 | 0 | else |
123 | 0 | { |
124 | 0 | CPLError(CE_Failure, CPLE_AppDefined, |
125 | 0 | "The Run() method should not be called directly on the \"gdal " |
126 | 0 | "vector\" program."); |
127 | 0 | return false; |
128 | 0 | } |
129 | 0 | } |
130 | | |
131 | | //! @endcond |