Support bounded Kempen-wide thematic rasters
This commit is contained in:
@@ -1316,6 +1316,10 @@ Settings: `THEMATIC_RASTER_ENABLED`, `THEMATIC_RASTER_WCS_URL`,
|
||||
`THEMATIC_RASTER_MIN_SIDE_M`, `THEMATIC_RASTER_MAX_SIDE_M`,
|
||||
`THEMATIC_RASTER_MAX_PIXELS`, `THEMATIC_RASTER_TIMEOUT_SECONDS` and
|
||||
`THEMATIC_RASTER_MAX_RESPONSE_MB`.
|
||||
The default thematic ceiling is 60 km and 30 million cells so the exact
|
||||
Kempen work area fits. External WCS transfers remain split into fixed 10 km
|
||||
tiles, product identifiers remain server-allowlisted and other raster
|
||||
pipelines retain their smaller independent limits.
|
||||
|
||||
Provision the official DOV soil polygons for Mol through the existing vector
|
||||
upload path:
|
||||
|
||||
@@ -59,8 +59,8 @@ class Settings(BaseSettings):
|
||||
validation_alias="THEMATIC_RASTER_WCS_URL",
|
||||
)
|
||||
thematic_raster_min_side_m: float = Field(default=100.0, gt=0, validation_alias="THEMATIC_RASTER_MIN_SIDE_M")
|
||||
thematic_raster_max_side_m: float = Field(default=20_000.0, gt=0, validation_alias="THEMATIC_RASTER_MAX_SIDE_M")
|
||||
thematic_raster_max_pixels: int = Field(default=12_000_000, ge=1, validation_alias="THEMATIC_RASTER_MAX_PIXELS")
|
||||
thematic_raster_max_side_m: float = Field(default=60_000.0, gt=0, validation_alias="THEMATIC_RASTER_MAX_SIDE_M")
|
||||
thematic_raster_max_pixels: int = Field(default=30_000_000, ge=1, validation_alias="THEMATIC_RASTER_MAX_PIXELS")
|
||||
thematic_raster_timeout_seconds: int = Field(default=300, ge=1, validation_alias="THEMATIC_RASTER_TIMEOUT_SECONDS")
|
||||
thematic_raster_max_response_mb: int = Field(default=160, ge=1, validation_alias="THEMATIC_RASTER_MAX_RESPONSE_MB")
|
||||
redis_url: str | None = Field(default=None, validation_alias="REDIS_URL")
|
||||
|
||||
@@ -148,6 +148,29 @@ def test_request_is_bounded_allowlisted_and_uses_native_wcs_resolution() -> None
|
||||
assert exc_info.value.code == "THEMATIC_RASTER_PRODUCT_NOT_SUPPORTED"
|
||||
|
||||
|
||||
def test_complete_kempen_scope_fits_the_tiled_thematic_guardrails() -> None:
|
||||
settings = Settings(_env_file=None)
|
||||
request = ThematicRasterAcquireRequest(
|
||||
bbox={
|
||||
"min_x": 4.59723873,
|
||||
"min_y": 51.01047967,
|
||||
"max_x": 5.26224853,
|
||||
"max_y": 51.50511313,
|
||||
"crs": "EPSG:4326",
|
||||
},
|
||||
product_key="space_occupation_2025",
|
||||
)
|
||||
|
||||
prepared = ThematicRasterAcquisitionService._prepared_request(request, settings)
|
||||
|
||||
assert prepared["width"] * prepared["height"] <= 30_000_000
|
||||
assert len(ThematicRasterAcquisitionService._tile_bounds(prepared)) > 1
|
||||
|
||||
with pytest.raises(AppError) as exc_info:
|
||||
ThematicRasterAcquisitionService._prepared_request(payload(side_m=61_000.0), settings)
|
||||
assert exc_info.value.code == "THEMATIC_RASTER_SELECTION_TOO_LARGE"
|
||||
|
||||
|
||||
def test_binary_and_normalized_products_fail_closed_on_invalid_values() -> None:
|
||||
binary = ThematicRasterAcquisitionService._product("space_occupation_2025")
|
||||
score = ThematicRasterAcquisitionService._product("service_level_2022")
|
||||
|
||||
Reference in New Issue
Block a user