mapchete.types module

class mapchete.types.Bounds(left: Iterable[float] | float, bottom: float | None, right: float | None, top: float | None, strict: bool = True)

Bases: list

Class to handle geographic bounds.

bottom: float = None
static from_dict(inp: dict, strict: bool = True) Bounds
classmethod from_inp(inp: List[float] | Tuple[float] | dict | shapely.geometry.base.BaseGeometry, strict: bool = True) Bounds
property geometry: shapely.geometry.base.BaseGeometry
height: float = None
intersects(other: List[float] | Tuple[float] | dict | shapely.geometry.base.BaseGeometry) bool

Indicate whether bounds intersect spatially.

left: float = None
right: float = None
to_dict() dict

Return dictionary representation.

top: float = None
width: float = None
class mapchete.types.Grid(transform: affine.Affine, height: int, width: int, crs: fiona.crs.CRS | rasterio.crs.CRS)

Bases: object

bounds: Bounds
crs: fiona.crs.CRS | rasterio.crs.CRS
static from_bounds(bounds: List[float] | Tuple[float] | dict | shapely.geometry.base.BaseGeometry, shape: tilematrix.Shape | List[int] | Tuple[int, int], crs: fiona.crs.CRS | rasterio.crs.CRS) Grid
static from_obj(obj)
height: int
shape: tilematrix.Shape
to_dict()
transform: affine.Affine
width: int
class mapchete.types.Progress(*, current: int = 0, total: int | None = None)

Bases: BaseModel

current: int
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'current': FieldInfo(annotation=int, required=False, default=0), 'total': FieldInfo(annotation=Union[int, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

total: int | None
class mapchete.types.ZoomLevels(min: List[int] | int, max: int | None = None, descending: bool = False)

Bases: list

descending() ZoomLevels
difference(other: List[int] | int | dict) ZoomLevels
static from_dict(inp: dict, **kwargs) ZoomLevels
classmethod from_inp(min: List[int] | int | dict, max: int | None = None, descending: bool = False) ZoomLevels

Constructs ZoomLevels from various input forms

static from_int(inp: int, **kwargs) ZoomLevels
static from_list(inp: List[int], **kwargs) ZoomLevels
intersection(other: List[int] | int | dict) ZoomLevels
intersects(other: List[int] | int | dict) bool
max: int = None
min: int = None
to_dict() dict