Extract values from raster
extract_values_from_raster(raster_list, geodataframe, raster_column_names=None)
Extract raster values using point data to a DataFrame.
If custom column names are not given, column names are file_name for singleband files and file_name_bandnumber for multiband files. If custom column names are given, there should be column names for each raster provided in the raster list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
raster_list |
Sequence[DatasetReader]
|
List to extract values from. |
required |
geodataframe |
GeoDataFrame
|
Object to extract values with. |
required |
raster_column_names |
Optional[Sequence[str]]
|
List of optional column names for bands. |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
Dataframe with x & y coordinates and the values from the raster file(s) as columns. |
Raises:
Type | Description |
---|---|
NonMatchingParameterLengthsException
|
raster_list and raster_columns_names have different lengths. |
Source code in eis_toolkit/raster_processing/extract_values_from_raster.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|