damagescanner.vector
Module Contents
Functions
|
Builds an SQL query from the values passed to the function. |
|
Function to extract specified geometry and keys/values from OpenStreetMap. |
|
Function to extract land-use polygons from OpenStreetMap |
|
Function to extract building polygons from OpenStreetMap |
|
Function to extract road linestrings from OpenStreetMap |
|
Function to extract railway linestrings from OpenStreetMap |
|
Function to extract road linestrings from OpenStreetMap |
|
Function to extract railway linestrings from OpenStreetMap |
|
Function to extract main road linestrings from OpenStreetMap |
Function to remove overlap in polygons in from OpenStreetMap. |
|
|
Function to extract value from column from other GeoDataFrame |
|
Function to reproject a GeoDataFrame to a different CRS. |
|
" |
- damagescanner.vector.query_b(geo_type, key_col, **val_constraint)[source]
Builds an SQL query from the values passed to the function.
- Arguments:
geo_type : Type of geometry (osm layer) to search for. key_col : A list of keys/columns that should be selected from the layer. val_constraint : A dictionary of constraints for the values. e.g. WHERE ‘value’>20 or ‘value’=’constraint’
- Returns:
string: A SQL query string.
- damagescanner.vector.retrieve(osm_path, geo_type, key_col, **val_constraint)[source]
Function to extract specified geometry and keys/values from OpenStreetMap.
- Arguments:
osm_path : file path to the .osm.pbf file of the region for which we want to do the analysis. geo_type : Type of Geometry to retrieve. e.g. lines, multipolygons, etc. key_col : These keys will be returned as columns in the dataframe. ***val_constraint: A dictionary specifying the value constraints. A key can have multiple values (as a list) for more than one constraint for key/value.
- Returns:
GeoDataFrame : a geopandas GeoDataFrame with all columns, geometries, and constraints specified.
- damagescanner.vector.landuse(osm_path)[source]
Function to extract land-use polygons from OpenStreetMap
- Arguments:
osm_path : file path to the .osm.pbf file of the region for which we want to do the analysis.
- Returns:
GeoDataFrame : a geopandas GeoDataFrame with all unique land-use polygons.
- damagescanner.vector.buildings(osm_path)[source]
Function to extract building polygons from OpenStreetMap
- Arguments:
osm_path : file path to the .osm.pbf file of the region for which we want to do the analysis.
- Returns:
GeoDataFrame : a geopandas GeoDataFrame with all unique building polygons.
- damagescanner.vector.roads(osm_path)[source]
Function to extract road linestrings from OpenStreetMap
- Arguments:
osm_path : file path to the .osm.pbf file of the region for which we want to do the analysis.
- Returns:
GeoDataFrame : a geopandas GeoDataFrame with all unique road linestrings.
- damagescanner.vector.railway(osm_path)[source]
Function to extract railway linestrings from OpenStreetMap
- Arguments:
osm_path : file path to the .osm.pbf file of the region for which we want to do the analysis.
- Returns:
GeoDataFrame : a geopandas GeoDataFrame with all unique land-use polygons.
- damagescanner.vector.ferries(osm_path)[source]
Function to extract road linestrings from OpenStreetMap
- Arguments:
osm_path : file path to the .osm.pbf file of the region for which we want to do the analysis.
- Returns:
GeoDataFrame : a geopandas GeoDataFrame with all unique road linestrings.
- damagescanner.vector.electricity(osm_path)[source]
Function to extract railway linestrings from OpenStreetMap
- Arguments:
osm_path : file path to the .osm.pbf file of the region for which we want to do the analysis.
- Returns:
GeoDataFrame : a geopandas GeoDataFrame with all unique land-use polygons.
- damagescanner.vector.mainRoads(osm_path)[source]
Function to extract main road linestrings from OpenStreetMap
- Arguments:
osm_path : file path to the .osm.pbf file of the region for which we want to do the analysis.
- Returns:
GeoDataFrame : a geopandas GeoDataFrame with all unique main road linestrings.
- damagescanner.vector.remove_overlap_openstreetmap(gdf)[source]
Function to remove overlap in polygons in from OpenStreetMap.
- Arguments:
gdf : a geopandas GeoDataFrame with all unique railway linestrings.
- Returns:
GeoDataFrame : a geopandas GeoDataFrame with (almost) non-overlapping polygons.
- damagescanner.vector.extract_value_other_gdf(x, gdf, col_name)[source]
Function to extract value from column from other GeoDataFrame
- Arguments:
x : row of main GeoDataFrame.
gdf : geopandas GeoDataFrame from which we want to extract values.
col_name : the column name from which we want to get the value.
- damagescanner.vector.reproject(df_ds, current_crs='epsg:4326', approximate_crs='epsg:3035')[source]
Function to reproject a GeoDataFrame to a different CRS.
- Args:
df_ds (pandas DataFrame): _description_ current_crs (str, optional): _description_. Defaults to “epsg:4326”. approximate_crs (str, optional): _description_. Defaults to “epsg:3035”.
- Returns:
_type_: _description_
- damagescanner.vector.get_damage_per_object(obj, df_ds, objects, curves, maxdam)[source]
” Function to calculate the damage per object.
- Args:
obj (tuple): The object for which we want to calculate the damage. df_ds (pandas DataFrame): The dataframe with the hazard points. objects (pandas DataFrame): The dataframe with the objects. curves (pandas DataFrame): The dataframe with the vulnerability curves. maxdam (dictionary): The dictionary with the maximum damage per object type.
- Returns:
tuple: The damage per object.