Skip to content

Commit

Permalink
feat: added bbox in read project's outline (#1244)
Browse files Browse the repository at this point in the history
Co-authored-by: sujanadh <sujanadh07@gmail.com>
  • Loading branch information
Sujanadh and sujanadh authored Feb 22, 2024
1 parent 535e720 commit d13579c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backend/app/projects/project_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from pydantic import BaseModel, Field, computed_field
from pydantic.functional_serializers import field_serializer
from pydantic.functional_validators import field_validator, model_validator
from shapely import wkb
from typing_extensions import Self

from app.config import HttpUrlStr, decrypt_value, encrypt_value
Expand Down Expand Up @@ -305,7 +306,9 @@ def outline_geojson(self) -> Optional[Feature]:
"""Compute the geojson outline from WKBElement outline."""
if not self.outline:
return None
return geometry_to_geojson(self.outline, {"id": self.id}, self.id)
geometry = wkb.loads(bytes(self.outline.data))
bbox = geometry.bounds # Calculate bounding box
return geometry_to_geojson(self.outline, {"id": self.id, "bbox": bbox}, self.id)


class ProjectOut(ProjectBase):
Expand Down

0 comments on commit d13579c

Please sign in to comment.