deafrica_tools.coastal#
Coastal analyses on Digital Earth Africa data.
Functions
|
Get DE Africa Coastlines data for a provided bounding box using WFS. |
|
|
|
|
|
|
|
|
|
Take a set of transects (e.g. shore-normal beach survey lines), and determine the distance along the transect to each object in a set of lines (e.g. shorelines). |
- deafrica_tools.coastal.get_coastlines(bbox: tuple, crs='EPSG:4326', layer='shorelines', drop_wms=True) geopandas.GeoDataFrame#
Get DE Africa Coastlines data for a provided bounding box using WFS.
For a full description of the DE Africa Coastlines dataset, refer to the official Digital Earth Africa product description:
- Parameters:
bbox ((xmin, ymin, xmax, ymax), or geopandas object) – Bounding box expressed as a tuple. Alternatively, a bounding box can be automatically extracted by suppling a geopandas.GeoDataFrame or geopandas.GeoSeries.
crs (str, optional) – Optional CRS for the bounding box. This is ignored if bbox is provided as a geopandas object.
layer (str, optional) – Which DE Africa Coastlines layer to load. Options include the annual shoreline vectors (“shorelines”) and the rates of change statistics points (“statistics”). Defaults to “shorelines”.
drop_wms (bool, optional) – Whether to drop WMS-specific attribute columns from the data. These columns are used for visualising the dataset on DE Africa Maps, and are unlikely to be useful for scientific analysis. Defaults to True.
- Returns:
A GeoDataFrame containing shoreline or point features and associated metadata.
- Return type:
gpd.GeoDataFrame
- deafrica_tools.coastal.transect_distances(transects_gdf, lines_gdf, mode='distance')#
Take a set of transects (e.g. shore-normal beach survey lines), and determine the distance along the transect to each object in a set of lines (e.g. shorelines). Distances are measured in the CRS of the input datasets.
For coastal applications, transects should be drawn from land to water (with the first point being on land so that it can be used as a consistent location from which to measure distances.
- The distance calculation can be performed using two modes:
‘distance’: Distances are measured from the start of the transect to where it intersects with each line. Any transect that intersects a line more than once is ignored. This mode is useful for measuring e.g. the distance to the shoreline over time from a consistent starting location.
‘width’ Distances are measured between the first and last intersection between a transect and each line. Any transect that intersects a line only once is ignored. This is useful for e.g. measuring the width of a narrow area of coastline over time, e.g. the neck of a spit or tombolo.
- Parameters:
transects_gdf (geopandas.GeoDataFrame) – A GeoDataFrame containing one or multiple vector profile lines. The GeoDataFrame’s index column will be used to name the rows in the output distance table.
lines_gdf (geopandas.GeoDataFrame) – A GeoDataFrame containing one or multiple vector line features that intersect the profile lines supplied to transects_gdf. The GeoDataFrame’s index column will be used to name the columns in the output distance table.
mode (string, optional) – Whether to use ‘distance’ (for measuring distances from the start of a profile) or ‘width’ mode (for measuring the width between two profile intersections). See docstring above for more info; defaults to ‘distance’.
- Returns:
distance_df – A DataFrame containing distance measurements for each profile line (rows) and line feature (columns).
- Return type:
pandas.DataFrame