• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geo-engine / geoengine / 23548132590

25 Mar 2026 03:06PM UTC coverage: 87.388%. First build
23548132590

Pull #1114

github

web-flow
Merge d0ebf151a into dccacebf2
Pull Request #1114: feat: STAC dataset import

592 of 1788 new or added lines in 12 files covered. (33.11%)

113703 of 130113 relevant lines covered (87.39%)

497588.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.7
/services/src/api/model/processing_graphs/mod.rs
1
#![allow(clippy::needless_for_each)] // TODO: remove when clippy is fixed for utoipa <https://github.com/juhaku/utoipa/issues/1420>
2

3
// use crate::api::model::processing_graphs::{
4
//     processing::{Expression, ExpressionParameters, RasterVectorJoin, RasterVectorJoinParameters},
5
//     source::{GdalSource, GdalSourceParameters, MockPointSource, MockPointSourceParameters},
6
// };
7
use geoengine_operators::{
8
    engine::{
9
        PlotOperator as OperatorsPlotOperator, RasterOperator as OperatorsRasterOperator,
10
        TypedOperator as OperatorsTypedOperator, VectorOperator as OperatorsVectorOperator,
11
    },
12
    mock::MockPointSource as OperatorsMockPointSource,
13
    plot::{Histogram as OperatorsHistogram, Statistics as OperatorsStatistics},
14
    processing::{
15
        BandFilter as OperatorsBandFilter, Expression as OperatorsExpression,
16
        Interpolation as OperatorsInterpolation, RasterStacker as OperatorsRasterStacker,
17
        RasterTypeConversion as OperatorsRasterTypeConversion,
18
        RasterVectorJoin as OperatorsRasterVectorJoin, Reprojection as OperatorsReprojection,
19
        TemporalRasterAggregation as OperatorsTemporalRasterAggregation,
20
    },
21
    source::{
22
        GdalSource as OperatorsGdalSource, MultiBandGdalSource as OperatorsMultiBandGdalSource,
23
    },
24
};
25
use serde::{Deserialize, Serialize};
26
use utoipa::{OpenApi, ToSchema};
27

28
mod macros;
29
mod parameters;
30
mod plots;
31
mod processing;
32
mod source;
33
mod source_parameters;
34

35
// TODO: avoid exporting them to outside of API module
36
#[cfg(test)]
37
pub(crate) use crate::api::model::processing_graphs::parameters::SpatialBoundsDerive;
38
pub(crate) use crate::api::model::processing_graphs::{
39
    plots::{Histogram, HistogramParameters, Statistics, StatisticsParameters},
40
    processing::{
41
        Aggregation, BandFilter, BandFilterParameters, BandsByNameOrIndex,
42
        DeriveOutRasterSpecsSource, Expression, ExpressionParameters, Interpolation,
43
        InterpolationMethod, InterpolationParameters, InterpolationResolution, RasterStacker,
44
        RasterStackerParameters, RasterTypeConversion, RasterTypeConversionParameters,
45
        RasterVectorJoin, RasterVectorJoinParameters, RenameBands, Reprojection,
46
        ReprojectionParameters, TemporalRasterAggregation, TemporalRasterAggregationParameters,
47
    },
48
    source::{
49
        GdalSource, GdalSourceParameters, MockPointSource, MockPointSourceParameters,
50
        MultiBandGdalSource,
51
    },
52
    source_parameters::{
53
        MultipleRasterOrSingleVectorOperator, MultipleRasterOrSingleVectorSource,
54
        MultipleRasterSources, SingleRasterOrVectorOperator, SingleRasterOrVectorSource,
55
        SingleRasterSource, SingleVectorMultipleRasterSources,
56
    },
57
};
58

59
/// Operator outputs are distinguished by their data type.
60
/// There are `raster`, `vector` and `plot` operators.
61
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
62
#[serde(tag = "type", content = "operator")]
63
pub enum TypedOperator {
64
    Vector(VectorOperator),
65
    Raster(RasterOperator),
66
    Plot(PlotOperator),
67
}
68

69
/// An operator that produces raster data.
70
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
71
#[serde(rename_all = "camelCase", untagged)]
72
#[schema(discriminator = "type")]
73
pub enum RasterOperator {
74
    BandFilter(BandFilter),
75
    Expression(Expression),
76
    GdalSource(GdalSource),
77
    Interpolation(Interpolation),
78
    MultiBandGdalSource(MultiBandGdalSource),
79
    RasterStacker(RasterStacker),
80
    RasterTypeConversion(RasterTypeConversion),
81
    Reprojection(Reprojection),
82
    TemporalRasterAggregation(TemporalRasterAggregation),
83
}
84

85
/// An operator that produces vector data.
86
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
87
#[serde(rename_all = "camelCase", untagged)]
88
#[schema(discriminator = "type")]
89
pub enum VectorOperator {
90
    MockPointSource(MockPointSource),
91
    RasterVectorJoin(RasterVectorJoin),
92
    Reprojection(Reprojection),
93
}
94

95
/// An operator that produces plot data.
96
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
97
#[serde(rename_all = "camelCase", untagged)]
98
#[schema(discriminator = "type")]
99
pub enum PlotOperator {
100
    Histogram(Histogram),
101
    Statistics(Statistics),
102
}
103

104
impl TryFrom<RasterOperator> for Box<dyn OperatorsRasterOperator> {
105
    type Error = anyhow::Error;
106
    fn try_from(operator: RasterOperator) -> Result<Self, Self::Error> {
47✔
107
        // TODO: Missing raster operator mappings (operators crate -> OpenAPI model):
108
        // [ ] BandNeighborhoodAggregate
109
        // [ ] BandwiseExpression
110
        // [ ] Downsampling
111
        // [ ] NeighborhoodAggregate
112
        // [ ] Onnx
113
        // [ ] RasterScaling
114
        // [ ] Rasterization
115
        // [ ] Reflectance
116
        // [ ] Radiance
117
        // [ ] Temperature
118
        // [ ] TimeShift
119
        match operator {
47✔
NEW
120
            RasterOperator::BandFilter(band_filter) => {
×
NEW
121
                OperatorsBandFilter::try_from(band_filter).map(OperatorsRasterOperator::boxed)
×
122
            }
123
            RasterOperator::Expression(expression) => {
×
124
                OperatorsExpression::try_from(expression).map(OperatorsRasterOperator::boxed)
×
125
            }
126
            RasterOperator::GdalSource(gdal_source) => {
41✔
127
                OperatorsGdalSource::try_from(gdal_source).map(OperatorsRasterOperator::boxed)
41✔
128
            }
NEW
129
            RasterOperator::Interpolation(interpolation) => {
×
NEW
130
                OperatorsInterpolation::try_from(interpolation).map(OperatorsRasterOperator::boxed)
×
131
            }
132
            RasterOperator::MultiBandGdalSource(gdal_source) => {
4✔
133
                OperatorsMultiBandGdalSource::try_from(gdal_source)
4✔
134
                    .map(OperatorsRasterOperator::boxed)
4✔
135
            }
136
            RasterOperator::RasterStacker(raster_stacker) => {
2✔
137
                OperatorsRasterStacker::try_from(raster_stacker).map(OperatorsRasterOperator::boxed)
2✔
138
            }
NEW
139
            RasterOperator::RasterTypeConversion(type_conversion) => {
×
NEW
140
                OperatorsRasterTypeConversion::try_from(type_conversion)
×
NEW
141
                    .map(OperatorsRasterOperator::boxed)
×
142
            }
NEW
143
            RasterOperator::Reprojection(reprojection) => {
×
NEW
144
                OperatorsReprojection::try_from(reprojection).map(OperatorsRasterOperator::boxed)
×
145
            }
NEW
146
            RasterOperator::TemporalRasterAggregation(aggregation) => {
×
NEW
147
                OperatorsTemporalRasterAggregation::try_from(aggregation)
×
NEW
148
                    .map(OperatorsRasterOperator::boxed)
×
149
            }
150
        }
151
    }
47✔
152
}
153

154
impl TryFrom<VectorOperator> for Box<dyn OperatorsVectorOperator> {
155
    type Error = anyhow::Error;
156
    fn try_from(operator: VectorOperator) -> Result<Self, Self::Error> {
9✔
157
        // TODO: Missing vector operator mappings (operators crate -> OpenAPI model):
158
        // [ ] ColumnRangeFilter
159
        // [ ] CsvSource
160
        // [ ] LineSimplification
161
        // [ ] MockDatasetDataSource
162
        // [ ] OgrSource
163
        // [ ] PointInPolygonFilter
164
        // [ ] TimeProjection
165
        // [ ] TimeShift
166
        // [ ] VectorExpression
167
        // [ ] VectorJoin
168
        // [ ] VisualPointClustering
169
        match operator {
9✔
170
            VectorOperator::MockPointSource(mock_point_source) => {
8✔
171
                OperatorsMockPointSource::try_from(mock_point_source)
8✔
172
                    .map(OperatorsVectorOperator::boxed)
8✔
173
            }
174
            VectorOperator::RasterVectorJoin(rvj) => {
×
175
                OperatorsRasterVectorJoin::try_from(rvj).map(OperatorsVectorOperator::boxed)
×
176
            }
177
            VectorOperator::Reprojection(reprojection) => {
1✔
178
                OperatorsReprojection::try_from(reprojection).map(OperatorsVectorOperator::boxed)
1✔
179
            }
180
        }
181
    }
9✔
182
}
183

184
impl TryFrom<PlotOperator> for Box<dyn OperatorsPlotOperator> {
185
    type Error = anyhow::Error;
186
    fn try_from(operator: PlotOperator) -> Result<Self, Self::Error> {
1✔
187
        // TODO: Missing plot operator mappings (operators crate -> OpenAPI model):
188
        // [ ] BoxPlot
189
        // [ ] ClassHistogram
190
        // [ ] FeatureAttributeValuesOverTime
191
        // [ ] MeanRasterPixelValuesOverTime
192
        // [ ] PieChart
193
        // [ ] ScatterPlot
194
        match operator {
1✔
195
            PlotOperator::Histogram(histogram) => {
×
196
                OperatorsHistogram::try_from(histogram).map(OperatorsPlotOperator::boxed)
×
197
            }
198
            PlotOperator::Statistics(statistics) => {
1✔
199
                OperatorsStatistics::try_from(statistics).map(OperatorsPlotOperator::boxed)
1✔
200
            }
201
        }
202
    }
1✔
203
}
204

205
impl TryFrom<TypedOperator> for OperatorsTypedOperator {
206
    type Error = anyhow::Error;
207
    fn try_from(operator: TypedOperator) -> Result<Self, Self::Error> {
32✔
208
        match operator {
32✔
209
            TypedOperator::Raster(raster_operator) => Ok(Self::Raster(raster_operator.try_into()?)),
27✔
210
            TypedOperator::Vector(vector_operator) => Ok(Self::Vector(vector_operator.try_into()?)),
4✔
211
            TypedOperator::Plot(plot_operator) => Ok(Self::Plot(plot_operator.try_into()?)),
1✔
212
        }
213
    }
32✔
214
}
215

216
#[derive(OpenApi)]
217
#[openapi(components(schemas(
218
    // General
219
    PlotOperator,
220
    TypedOperator,
221
    VectorOperator,
222
    // Source
223
    GdalSource,
224
    GdalSourceParameters,
225
    MockPointSource,
226
    MockPointSourceParameters,
227
    MultiBandGdalSource,
228
    // Processing
229
    Aggregation,
230
    BandFilter,
231
    BandFilterParameters,
232
    BandsByNameOrIndex,
233
    DeriveOutRasterSpecsSource,
234
    Expression,
235
    ExpressionParameters,
236
    Interpolation,
237
    InterpolationMethod,
238
    InterpolationParameters,
239
    InterpolationResolution,
240
    RasterOperator,
241
    RasterStacker,
242
    RasterStackerParameters,
243
    RasterTypeConversion,
244
    RasterTypeConversionParameters,
245
    RasterVectorJoin,
246
    RasterVectorJoinParameters,
247
    RenameBands,
248
    Reprojection,
249
    ReprojectionParameters,
250
    TemporalRasterAggregation,
251
    TemporalRasterAggregationParameters,
252
    // Plots
253
    Histogram,
254
    HistogramParameters,
255
    Statistics,
256
    StatisticsParameters,
257
    // Source Parameters
258
    MultipleRasterOrSingleVectorOperator,
259
    MultipleRasterOrSingleVectorSource,
260
    MultipleRasterSources,
261
    SingleRasterOrVectorOperator,
262
    SingleRasterOrVectorSource,
263
    SingleRasterSource,
264
    SingleVectorMultipleRasterSources,
265

266
)))]
267
pub struct OperatorsApi;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc