Skip to content

Geometry

Optional, and backed by 'sf'. The core is geometry-free.

attach_geometry_geoscale

attach_geometry_geoscale(
    x: GeoScale,
    geom: Any,
    by: str | None = None,
    geoframe: str | None = None,
    crs: Any = None,
) -> GeoScale

Attach per-atom geometry.

geom is a GeoDataFrame matched on code column by (default: the geoframe's name, else region; with a coarser geoframe every atom inherits its parent's shape), or a sequence of shapely geometries already in leaftable row order (then crs= gives its CRS).

geoscale_geometry

geoscale_geometry(
    x: GeoScale,
    geoframe: str | None = None,
    precision: float = 0,
)

One dissolved geometry per code at geoframe, in member order, as a GeoDataFrame (columns: the geoframe, geometry).

coords_to_region

coords_to_region(
    x: Any,
    gs: GeoScale,
    geoframe: str | None = None,
    coords: Sequence[str] = ("lon", "lat"),
    crs: Any = 4326,
) -> list

The code at geoframe of the region containing each point (first match in member order; None outside every region).

add_area_geoscale

add_area_geoscale(
    x: GeoScale, name: str = "km2", crs: str = "ESRI:54034"
) -> GeoScale

Add each atom's area (km2, in the equal-area crs) as a weight column.