Add map area selection extraction
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
|
||||
|
||||
class VectorOperationResult(BaseModel):
|
||||
@@ -191,3 +191,31 @@ class VectorStatsResponse(BaseModel):
|
||||
geometry_type_summary: dict[str, int]
|
||||
bounds_json: dict | None
|
||||
crs: str | None = None
|
||||
|
||||
|
||||
class VectorSelectionBBox(BaseModel):
|
||||
min_x: float
|
||||
min_y: float
|
||||
max_x: float
|
||||
max_y: float
|
||||
crs: str = "EPSG:4326"
|
||||
|
||||
@field_validator("crs")
|
||||
@classmethod
|
||||
def validate_crs(cls, value: str) -> str:
|
||||
if value.upper() != "EPSG:4326":
|
||||
raise ValueError("Only EPSG:4326 bbox selection is supported")
|
||||
return "EPSG:4326"
|
||||
|
||||
|
||||
class VectorSelectionRequest(BaseModel):
|
||||
bbox: VectorSelectionBBox
|
||||
limit: int = Field(default=100, ge=1, le=1000)
|
||||
|
||||
|
||||
class VectorSelectionResponse(BaseModel):
|
||||
selection_bbox: VectorSelectionBBox
|
||||
feature_count: int
|
||||
limit: int
|
||||
truncated: bool
|
||||
geojson: dict
|
||||
|
||||
Reference in New Issue
Block a user