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: Optional[Set[str]] = None,
    exclude: Optional[Set[str]] = 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.

get_bool_env

def get_bool_env(
    name: str,
    default: Union[bool, str] = False
) -> bool

Retrieve a boolean value from an environment variable.

Parameters:

Name Type Description Default
name str The name of the environment variable. None
default Union[bool, str] The default value to use if the variable is not set or unrecognized. Defaults to False. False

Returns:

Type Description
bool The boolean value parsed from the environment variable.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy