Closed kdesjard closed 5 months ago
That's a great addition, thanks!
Do you have a dataset to test with?
How do I test against a Pg DB?
I've added the following test:
#[tokio::test]
#[ignore]
async fn pg_datetime_filter() {
let filter = FilterParams {
limit: None,
offset: None,
bbox: None,
datetime: Some("2024-01-01T00:00:00Z".to_string()),
filters: HashMap::new(),
};
let ds = PgDatasource::new_pool("postgresql://t_rex:t_rex@127.0.0.1:5439/t_rex_tests")
.await
.unwrap();
let source = PgCollectionSource {
ds,
sql: "SELECT *, '2024-01-01 00:00:00Z'::timestamptz - (fid-1) * INTERVAL '1 day' AS ts FROM ne.ne_10m_rivers_lake_centerlines".to_string(),
geometry_column: "wkb_geometry".to_string(),
pk_column: Some("fid".to_string()),
temporal_column: Some("ts".to_string()),
other_columns: HashMap::new(),
};
let items = source.items(&filter).await.unwrap();
assert_eq!(items.features.len(), 1);
}
which can be run with cargo test -- --ignored
The test database must be started with docker run -p 127.0.0.1:5439:5432 -d --name trextestdb --rm sourcepole/trextestdb
If you give me push permissions to your PR, I can add my test directly (see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork).
Allow edits is enabled.
Get an error:
To github.com:kdesjard/bbox.git
! [remote rejected] kdesjard-temporal_and_other_searching -> kdesjard-temporal_and_other_searching (permission denied)
Nevermind. Will merge and add my test.
For your consideration, a pull request to enable temporal searching based on:
https://docs.ogc.org/is/17-069r4/17-069r4.html#_parameter_datetime
As well arbitrary user-defined fields (via configuration) mapped to columns in the postgis DB.
https://docs.ogc.org/is/17-069r4/17-069r4.html#_parameters_for_filtering_on_feature_properties