Skip to main content

oxigdal_services/ogc_features/
query.rs

1//! Query parameter types for OGC Features API requests.
2
3use super::types::DateTimeFilter;
4
5/// Language used for the `filter` parameter
6#[derive(Debug, Clone, PartialEq)]
7pub enum FilterLang {
8    /// CQL2 text encoding
9    Cql2Text,
10    /// CQL2 JSON encoding
11    Cql2Json,
12}
13
14/// Query parameters for `GET /collections/{id}/items`
15#[derive(Debug, Clone, Default)]
16pub struct QueryParams {
17    /// Maximum number of features to return (server default: 10, max: 10 000)
18    pub limit: Option<u32>,
19
20    /// Number of features to skip (for pagination)
21    pub offset: Option<u32>,
22
23    /// Spatial filter as `[xmin, ymin, xmax, ymax]`
24    pub bbox: Option<[f64; 4]>,
25
26    /// CRS for the bbox (Part 2)
27    pub bbox_crs: Option<String>,
28
29    /// Temporal filter
30    pub datetime: Option<DateTimeFilter>,
31
32    /// CQL2 filter expression
33    pub filter: Option<String>,
34
35    /// Language of the filter expression
36    pub filter_lang: Option<FilterLang>,
37
38    /// CRS for the response geometry (Part 2)
39    pub crs: Option<String>,
40
41    /// Property selection (return only these properties)
42    pub properties: Option<Vec<String>>,
43}
44
45impl QueryParams {
46    /// Effective limit, applying the default of 10.
47    pub fn effective_limit(&self) -> u32 {
48        self.limit.unwrap_or(10)
49    }
50
51    /// Effective offset, applying the default of 0.
52    pub fn effective_offset(&self) -> u32 {
53        self.offset.unwrap_or(0)
54    }
55}