Skip to content

Commit 078c127

Browse files
jdroennermichaelmattigChristianBeilschmidt
authored
feat: pixel based query rects for raster requests (#854)
* remove test ouptuts * add optional bounds points mock source, adapt rasterization tests * remove prints * adapt to changes * building again * building operators * remove debug output * more tests * adapt to changes * remove debug output * remove dbg! calls * more tests * clippy fix datatypes * fix clippy things in services * clippy lints and reduce complexity * more lints and renames * adapt cache text * more lints * use correct type ein api * interpolation: reuse geotransform and use fail safe lookup * remove unused methods * update tests * togeotiff: don't set tiled for COG * use type from api model in dataset handlers * reuse pixel to tiling logic * remove resolution from VectorStreamQuery * RasterWebsocketStream: log why stream was closed * use SpatialReference to lookup specs * remove unused code * add MlModelResource conversion * adapt dataset * streamline tiling * tiling cleanup and adapt s2 stac provider * change how raster bounds are reprojected: use actual coords and discard invalid ones. * prepare up side down raster reading * update test images * workflow optimization (wip) * add downscaled ndvi test data set * optimization for interpolation * downsampling optimization * projection optimization * optimization in wms and wcs * test optimization in wms * optimization for rasterization * optimization of raster vector join * test optimization on finer resolution * lintst & SpatialReference by value * implement optimization for more operators * solve Fixme on partitions_extent * fmt * test optimization of complex workflow * optimization for plots * clean up code * bring back flip-y and add overview level loading * cleenup * adapt tests * fix gdal source initialization * add test that optimization removes redundant upsampling * remove enum from RasterResultDescriptor * lints * migration of RasterResultDescriptor * remove sentinel-2 zones and bands from provider * adapt to main changes * fix tests * move s2 provider zones * lints * fix test * use TimeInterval in netcdf tests * fix gbif test * bring back soem benches + linter * fmt * reduce wms cache test area * update ndvi_list dataset * sql lints * sql lints * sql lints * sql lints * update dataset defs * measurement serialization and use btreemap for classes * adapt datasets api type * don't fail on resolution=None * update openapi * lints * update RasterDatasetFromWorkflow schema * update openapi * clippy :) * clippy * clippy * copy gdal source * load single tile from multiple files (wip) * load tiles from db (wip) * rename type SpatialQuery to SpatialBounds * rename field spatial_query -> spatial_bounds * fmt * remove RasterSpatialQueryRectangle and use GRidBoundingBox2D direct * fix and test (wip) * clean up (wip) * more tests * add test with reversed z index * clean up * migration and tests * VisualPointClusteringParams * LineSimplification only use epsilon * adapt to main chantes * fmt * reorder migrations * remove pub in QueryRectangle * add text to reproject_spatial_grid_bounds * cleanup QueryRectangle * make MockQueryContext creation more private * chores * trailing whitespace * bump version * rebase current_schema * reorder attributes make the test happy * remove fixmes * overview resolution for test pngs * update openapi * update migration name * fmt * move more to_dataset logic into task * bring back density rasterization * more density rastizion * re-activate and fix tests * bring back tests for density rasterizer * remove todo from ArunaDataProvider * update sentinel providers * add multi tiles tests to operators crate * add benchmark new vs old gdal source * fix bench and buffer new gdal source * clean up code * clippy * example for importing tiles from a directory * fix edge case where no tile is inside query rectangle. fix layers with datasets using new gdal source. add force example http calls * fix test and clippy * clippy * fix tests * clippy * make pixel edge check more robust with respect to floating point imprecisions * cargo fmt * optimize new gdal source * fix(operators)!: resolution in visual clustering * flip QueryProcessor impl for RasterQueryProcessor to RasterQueryProcessor: QueryProcessor * time filler part 1 * reading overview levels from multi tiles * clean up code * refactor read advise calculation * finalize TimeDescriptor and time_query * fmt * fluff1 * fluff2 * fix time dimension of test dataset * vector reprojection optimization * remove skipping no-data tiles in GdalSource, add wms return empty tiles if query out of data bounds * reinitialize workflow to fix operator path * some cleanup * validate tile compatibility * produce warning in rasterisation operator * check tile validity on insert and perform batches * clippy * use time gap filler and fix gap filling for regular time series in database * revert default buffer size * implement time_query for new gdal source * cargo fmt * add default time_query impl for regular time * force example * update clippy fix * check TiimeStep to be > 0 * update dataset extend when inserting new tiles * check tile alignment before insertion * refactor clippy * clippy * fix errors introduced while fixing lints * sqlfluff * layer collection for tile import * add id to tiles fix time query edge case fix time in tile import example * make file paths relative to volume * turn example into cli * clippy * add remote data dir to cli params * fix test * adjust openapi * remove empty lines * update openapi.json * change time dimension repr in openapi * fix time descriptor * fix wfs open api spec * fix wms/wcs * clippy * change deserialization of ogc queries * remove query resolution form wfs * fix ogc openapi schema * fix schemas * cargo fmt * remove redundant type * fix import lost in merge * more helpfull debug output * more helpful debug output * fix: properly initialize wrapped operator * fix: remove workflow benchmarks using gdal becaue benchmark logic no longer works now that resolutions are no longer part of the query rectangle * remove all workflow benches * fix: shift overview grid by a pixel fraction if needed * fix: unify geotransform in api * reduce no-data tiles produced in empty tile-intervals with regular steps * make GeoTransform Copy * check WMS request size * check WMS image size * remove unused TimeStep::new_unchecked * delete empty file * more detailed method name * renumber migrations * remove obsolete test --------- Co-authored-by: Michael Mattig <michael.m@ttig.de> Co-authored-by: Christian Beilschmidt <christian.beilschmidt@geoengine.de>
1 parent 0a5e73d commit 078c127

File tree

431 files changed

+34959
-13224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

431 files changed

+34959
-13224
lines changed

Cargo.lock

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exclude = [
88
resolver = "2"
99

1010
[workspace.package]
11-
version = "0.8.0"
11+
version = "0.9.0"
1212
authors = [
1313
"Christian Beilschmidt <beilschmidt@mathematik.uni-marburg.de>",
1414
"Johannes Drönner <droenner@mathematik.uni-marburg.de>",
@@ -156,7 +156,8 @@ pwhash = "1.0"
156156
quote = "1.0"
157157
rand = "0.9"
158158
rayon = "1.8"
159-
reqwest = { version = "0.12", features = [ # must be compatible with `oauth2`
159+
regex = "1.11"
160+
reqwest = { version = "0.12", features = [
160161
"json",
161162
"multipart",
162163
"stream",

Settings-default.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ password = "geoengine"
3434
clear_database_on_start = false
3535

3636
[raster.tiling_specification]
37-
origin_coordinate_x = 0.0
38-
origin_coordinate_y = 0.0
3937
tile_shape_pixels_x = 512
4038
tile_shape_pixels_y = 512
4139

@@ -84,6 +82,8 @@ tile_limit = 4
8482

8583
[wms]
8684
# request_timeout_seconds = 3600
85+
max_image_width = 4096
86+
max_image_height = 4096
8787

8888
[wfs]
8989
# request_timeout_seconds = 3600

Settings-test.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ password = "geoengine"
1010
raster_data_root_path = "../test_data/raster" # relative to sub crate directory for tests
1111

1212
[raster.tiling_specification]
13-
origin_coordinate_x = 0.0
14-
origin_coordinate_y = 0.0
1513
tile_shape_pixels_x = 512
1614
tile_shape_pixels_y = 512
1715

datatypes/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ arrow-schema = { workspace = true }
1818
bytes = { workspace = true }
1919
chrono = { workspace = true }
2020
fallible-iterator = { workspace = true }
21+
futures = { workspace = true }
2122
float-cmp = { workspace = true }
2223
gdal = { workspace = true }
2324
geo = { workspace = true }

datatypes/src/error.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ pub enum Error {
104104
i2: TimeInterval,
105105
},
106106

107+
#[snafu(display("Time step must be greater than zero, got: {}", step))]
108+
TimeStepStepMustBeGreaterThanZero {
109+
step: u32,
110+
},
111+
107112
#[snafu(display(
108113
"{} must be larger than {} and {} must be smaller than {}",
109114
start.inner(),
@@ -294,7 +299,7 @@ pub enum Error {
294299
WrongMetadataType,
295300

296301
#[snafu(display(
297-
"The conditions ul.x < lr.x && ul.y < lr.y are not met by ul:{} lr:{}",
302+
"The conditions ul.x < lr.x && ul.y > lr.y are not met by ul:{} lr:{}",
298303
upper_left_coordinate,
299304
lower_right_coordinate
300305
))]
@@ -345,6 +350,8 @@ pub enum Error {
345350
DuplicateBandInQueryBandSelection,
346351
QueryBandSelectionMustNotBeEmpty,
347352

353+
TilingGeoTransformOriginCoordinateMismatch,
354+
TilingGeoTransformResolutionMissmatch,
348355
#[snafu(display("Invalid number of suffixes, expected {} found {}", expected, found))]
349356
InvalidNumberOfSuffixes {
350357
expected: usize,
@@ -363,6 +370,11 @@ pub enum Error {
363370
expected: usize,
364371
found: usize,
365372
},
373+
NoIntersectionWithTargetProjection {
374+
srs_in: SpatialReference,
375+
srs_out: SpatialReference,
376+
bounds: BoundingBox2D,
377+
},
366378
}
367379

368380
impl From<arrow::error::ArrowError> for Error {

datatypes/src/operations/image/colorizer.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ impl From<Colorizer> for RasterColorizer {
4646
}
4747
}
4848

49+
impl RasterColorizer {
50+
/// Returns the no data color of this raster colorizer
51+
pub fn no_data_color(&self) -> RgbaColor {
52+
match self {
53+
RasterColorizer::SingleBand { band_colorizer, .. } => band_colorizer.no_data_color(),
54+
RasterColorizer::MultiBand { rgb_params, .. } => rgb_params.no_data_color,
55+
}
56+
}
57+
}
58+
4959
/// The parameters for the RGBA colorizer
5060
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq)]
5161
#[serde(rename_all = "camelCase")]

datatypes/src/operations/image/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ pub use colorizer::{
88
};
99
pub use into_lossy::LossyInto;
1010
pub use rgba_transmutable::RgbaTransmutable;
11-
pub use to_png::ToPng;
11+
pub use to_png::{ToPng, create_empty_no_data_color_png_bytes};

datatypes/src/operations/image/to_png.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ pub trait ToPng {
3434
) -> Result<Vec<u8>>;
3535
}
3636

37+
pub fn create_empty_no_data_color_png_bytes(
38+
width: u32,
39+
height: u32,
40+
no_data_color: RgbaColor,
41+
) -> Result<Vec<u8>> {
42+
let image_buffer = ImageBuffer::from_pixel(width, height, no_data_color.into());
43+
image_buffer_to_png_bytes(image_buffer)
44+
}
45+
3746
fn image_buffer_to_png_bytes(
3847
image_buffer: ImageBuffer<image::Rgba<u8>, Vec<u8>>,
3948
) -> Result<Vec<u8>> {
@@ -121,9 +130,7 @@ where
121130
) -> Result<Vec<u8>> {
122131
// TODO: use PNG color palette once it is available
123132

124-
let image_buffer = ImageBuffer::from_pixel(width, height, no_data_color.into());
125-
126-
image_buffer_to_png_bytes(image_buffer)
133+
create_empty_no_data_color_png_bytes(width, height, no_data_color)
127134
}
128135
}
129136

0 commit comments

Comments
 (0)