Skip to content

Commit 6ca1f19

Browse files
authored
feat: update bbox when updating geometry (#414)
Update Item bbox when updating an Item geometry with the update_geometry_from_asset_footprint method in the raster_footprint module
1 parent c2bdf32 commit 6ca1f19

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- `densify_by_factor` now includes the final coordinate in the original coordinate list in the returned densifed coordinate list ([#412](https://github.com/stac-utils/stactools/pull/412))
1414
- The `footprint` method on the `RasterFootprint` class now always returns counter-clockwise polygons in line with the GeoJSON specification ([#412](https://github.com/stac-utils/stactools/pull/412))
1515

16+
### Changed
17+
18+
- `update_geometry_from_asset_footprint` in the raster_footprint module now updates the Item bbox based on the updated geometry extents ([#414](https://github.com/stac-utils/stactools/pull/414))
19+
1620
## [0.4.5] - 2023-03-24
1721

1822
### Added

src/stactools/core/utils/raster_footprint.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ def update_geometry_from_asset_footprint(
506506
"""Accepts an Item and an optional list of asset names within that
507507
Item, and updates the geometry of that Item in-place with the data
508508
footprint derived from the first of the assets that exists in the Item.
509+
The Item bbox is also updated in-place to bound the new footprint
510+
extents.
509511
510512
See :class:`RasterFootprint` for details on the data footprint
511513
calculation.
@@ -565,6 +567,7 @@ def update_geometry_from_asset_footprint(
565567
if asset_name_and_extent is not None:
566568
_, extent = asset_name_and_extent
567569
item.geometry = extent
570+
item.bbox = list(shape(extent).bounds)
568571
return True
569572
else:
570573
return False
@@ -680,7 +683,8 @@ def update_geometry_from_asset_footprint(
680683
681684
Accepts an Item and an optional list of asset names within that Item, and
682685
updates the geometry of that Item in-place with the data footprint derived
683-
from the first of the assets that exists in the Item.
686+
from the first of the assets that exists in the Item. The Item bbox is also
687+
updated in-place to bound the new footprint extents.
684688
685689
See :class:`RasterFootprint` for details on the data footprint
686690
calculation.

0 commit comments

Comments
 (0)