Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions operators/src/util/wrap_with_projection_and_resample.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
use crate::engine::{
CanonicOperatorName, ExecutionContext, InitializedRasterOperator, RasterOperator,
RasterResultDescriptor, ResultDescriptor, SingleRasterOrVectorSource, WorkflowOperatorPath,
ExecutionContext, InitializedRasterOperator, RasterOperator, RasterResultDescriptor,
ResultDescriptor, SingleRasterOrVectorSource, WorkflowOperatorPath,
};
use crate::error::{self, Optimization};
use crate::processing::{
DeriveOutRasterSpecsSource, Downsampling, DownsamplingMethod, DownsamplingParams,
DownsamplingResolution, InitializedRasterReprojection, Interpolation, InterpolationMethod,
InterpolationParams, InterpolationResolution, Reprojection, ReprojectionParams,
DownsamplingResolution, Interpolation, InterpolationMethod, InterpolationParams,
InterpolationResolution, Reprojection, ReprojectionParams,
};
use crate::util::Result;
use crate::util::input::RasterOrVectorOperator;
use geoengine_datatypes::primitives::{
Coordinate2D, SpatialResolution, find_next_best_overview_level_resolution,
};
use geoengine_datatypes::raster::TilingSpecification;
use geoengine_datatypes::spatial_reference::SpatialReference;
use snafu::ResultExt;

Expand Down Expand Up @@ -44,11 +43,11 @@ impl WrapWithProjectionAndResample {
}
}

pub fn wrap_with_projection(
pub async fn wrap_with_projection(
self,
target_sref: SpatialReference,
_target_origin_reference: Option<Coordinate2D>, // TODO: add resampling if origin does not match! Could also do that in projection and avoid extra operation?
tiling_spec: TilingSpecification,
exe_ctx: &dyn ExecutionContext,
) -> Result<Self> {
let result_sref = self
.result_descriptor
Expand All @@ -75,20 +74,16 @@ impl WrapWithProjectionAndResample {
sources: SingleRasterOrVectorSource {
source: RasterOrVectorOperator::Raster(self.operator),
},
};
}
.boxed();

// create the inititalized operator directly, to avoid re-initializing everything
// TODO: update the workflow operator path in all operators of the graph!
let irp = InitializedRasterReprojection::try_new_with_input(
CanonicOperatorName::from(&reprojected_workflow),
WorkflowOperatorPath::initialize_root(), // FIXME: this is not correct since the root is the child operator
reprojection_params,
self.initialized_operator,
tiling_spec,
)?;
let rd = irp.result_descriptor().clone();
let irp = reprojected_workflow
.clone()
.initialize(WorkflowOperatorPath::initialize_root(), exe_ctx)
.await?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hast du mal geschaut was das für eine Auswirkung hat? Also dauert das irgendwie deutlich länger?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nein. soll ich einen benchmark schreiben?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nee mir hätte einfach mal ausprobieren gereicht


Self::new(reprojected_workflow.boxed(), irp.boxed(), rd)
let rd = irp.result_descriptor().clone();
Self::new(reprojected_workflow, irp.boxed(), rd)
};
Ok(res)
}
Expand Down Expand Up @@ -258,10 +253,10 @@ impl WrapWithProjectionAndResample {
target_origin_reference: Option<Coordinate2D>,
target_spatial_resolution: Option<SpatialResolution>,
target_sref: SpatialReference,
tiling_spec: TilingSpecification,
exe_ctx: &dyn ExecutionContext,
) -> Result<Self> {
self.wrap_with_projection(target_sref, target_origin_reference, tiling_spec)?
self.wrap_with_projection(target_sref, target_origin_reference, exe_ctx)
.await?
.wrap_with_resample(target_origin_reference, target_spatial_resolution, exe_ctx)
.await
}
Expand Down
1 change: 0 additions & 1 deletion services/src/api/handlers/wcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ async fn wcs_get_coverage<C: ApplicationContext>(
Some(request_partition.upper_left()), // TODO: set none if not changed? But how to handle mapping to grid?
request_resolution,
request_spatial_ref,
tiling_spec,
&execution_context,
)
.await?;
Expand Down
1 change: 0 additions & 1 deletion services/src/api/handlers/wms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ async fn wms_get_map<C: ApplicationContext>(
None, // this needs to be `None`` to avoid moving the data origin to a png pixel origin. Since the WMS requests are not consistent with their origins using them distortes the results more then it helps.
Some(request_resolution),
request_spatial_ref.into(),
tiling_spec,
&execution_context,
)
.await?;
Expand Down