Skip to content

Module stac_fastapi.core.utilities

Module for geospatial processing functions.

This module contains functions for transforming geospatial coordinates, such as converting bounding boxes to polygon representations.

Variables

MAX_LIMIT

Functions

bbox2polygon

def bbox2polygon(
    b0: float,
    b1: float,
    b2: float,
    b3: float
) -> List[List[List[float]]]

Transform a bounding box represented by its four coordinates b0, b1, b2, and b3 into a polygon.

Parameters:

Name Type Description Default
b0 float The x-coordinate of the lower-left corner of the bounding box. None
b1 float The y-coordinate of the lower-left corner of the bounding box. None
b2 float The x-coordinate of the upper-right corner of the bounding box. None
b3 float The y-coordinate of the upper-right corner of the bounding box. None

Returns:

Type Description
List[List[List[float]]] A polygon represented as a list of lists of coordinates.

dict_deep_update

def dict_deep_update(
    merge_to: Dict[str, Any],
    merge_from: Dict[str, Any]
) -> None

Perform a deep update of two dicts.

merge_to is updated in-place with the values from merge_from. merge_from values take precedence over existing values in merge_to.

filter_fields

def filter_fields(
    item: Union[stac_fastapi.types.stac.Item, Dict[str, Any]],
    include: Union[Set[str], NoneType] = None,
    exclude: Union[Set[str], NoneType] = None
) -> stac_fastapi.types.stac.Item

Preserve and remove fields as indicated by the fields extension include/exclude sets.

Returns a shallow copy of the Item with the fields filtered.

This will not perform a deep copy; values of the original item will be referenced in the return item.