cityImage.land_use_from_other_gdf#

cityImage.land_use_from_other_gdf(buildings_gdf, other_gdf, new_land_use_column, other_land_use_column, min_overlap_threshold=0.2, overlap_column_name=None, fill_default_when_no_match=True, default_land_use='residential')[source]#

Assign land-use labels to buildings by spatially matching against other_gdf.

Modes#

  • Point mode: other_gdf contains only Point/MultiPoint. For each building, collect labels from all points intersecting the building polygon. No overlap column is created in point mode.

  • Polygon mode: other_gdf contains only Polygon/MultiPolygon. For each building, intersect matching polygons and aggregate overlap fractions (intersection area / building area), then sum by label.

type buildings_gdf:

GeoDataFrame

param buildings_gdf:

Target building footprints (polygons). CRS must match other_gdf.

type buildings_gdf:

GeoDataFrame

type other_gdf:

GeoDataFrame

param other_gdf:

Source geometries (Points/MultiPoints or Polygons/MultiPolygons) with labels in other_land_use_column. Must be non-empty and have valid geometries. CRS must match buildings_gdf.

type other_gdf:

GeoDataFrame

param new_land_use_column:

Output column name. Each cell will be list[str].

type new_land_use_column:

str

param other_land_use_column:

Label column in other_gdf. Values may be scalar or list-like (already clean/classified).

type other_land_use_column:

str

param min_overlap_threshold:

Polygon mode only. Minimum per-intersection fraction of building area required for a polygon match. Applied per polygon intersection before aggregation.

type min_overlap_threshold:

float

param overlap_column_name:

Polygon mode only. If not None, creates this column as list[float] aligned 1:1 with new_land_use_column. Point mode ignores this parameter and never creates an overlap column.

type overlap_column_name:

str | None

param fill_default_when_no_match:

If True, buildings with no matches receive [default_land_use]. If False, they keep empty lists.

type fill_default_when_no_match:

bool

param default_land_use:

Default label used when fill_default_when_no_match=True and no matches are found.

type default_land_use:

str

returns:

Copy of buildings_gdf with new_land_use_column populated (list[str] per row). In polygon mode, if overlap_column_name is provided, also includes an overlap column (list[float] per row aligned 1:1 with the labels).

rtype:

GeoDataFrame

raises ValueError:
  • CRS mismatch - other_gdf is empty or has no valid geometries - unsupported/mixed geometry types in other_gdf