Parcel Fetching#

Retrieve building parcels from various sources.

shift.parcels_from_geodataframe(geo_df: GeoDataFrame, mapper: ParcelFieldMapper | None = None, name_column: str | None = None) → list[ParcelModel]#

Convert a GeoDataFrame into a list of ParcelModel.

The four parcel attributes (building_type, city, state, postal_address) are populated through mapper which maps source columns onto those fields. Defaults to OSMParcelFieldMapper, so the OSM/Overpass behavior is unchanged. When name_column is provided its cleaned value becomes the parcel name; otherwise parcels are named parcel_{index}.

Parameters:
  • geo_df (GeoDataFrame) – Geo dataframe with a geometry column.

  • mapper (ParcelFieldMapper | None) – Maps source columns to parcel fields.

  • name_column (str | None) – Source column to use as the parcel name.

Returns:

list[ParcelModel]

shift.parcels_from_location(location: str | ~shift.data_model.GeoLocation | list[~shift.data_model.GeoLocation], max_distance: ~infrasys.quantities.Distance = <Quantity(500, 'meter')>) → list[ParcelModel] | None#

Function to return parcels for a given location.

Note max_distance is not used if location type is Polygon. For a location of type str and GeoLocation, a polygon is created by forming a sqaure bounding box using max distance. We use osmnx package to fetch these buildings.

Parameters:
  • location (str | GeoLocation | Polygon) – Location for which openstreet parcels are to be fetched.

  • max_distance (Distance) – Maximum distance to form a bounding box within which buildings are fetched.

Returns:

List of ParcelModel.

Return type:

list[ParcelModel]

Examples

>>> from shift.parcel.openstreet import get_parcels
>>> from infrasys.quantities import Distance
>>> get_parcels("Fort Worth, Texas", Distance(100, "m"))
shift.parcels_from_csv(file_path: Path)#

Function to load parcels from csv.

Note, this function uses geopandas to construct geo dataframe which requires that you have at least a column named geometry in your file.

Parameters:

file_path (Path to csv file with geometries.)