eumap.mapper.SpaceOverlay¶
- class SpaceOverlay(points, fn_layers=[], dir_layers=[], regex_layers='*.tif', max_workers=2, verbose=True)[source]¶
Bases:
object
Overlay a set of points over multiple raster files. The retrieved pixel values are organized in columns according to the filenames.
- Parameters
points – The path for vector file or
geopandas.GeoDataFrame
with the points.fn_layers (
List
[str
]) – A list with the raster file paths. If it’s not provided thedir_layers
andregex_layers
are used to retrieve the raster files.dir_layers (
List
[str
]) – A list of folders where the raster files are located. The raster are selected according to the pattern specified inregex_layers
.regex_layers – Pattern to select the raster files in
dir_layers
. By default all GeoTIFF files are selected.max_workers (
int
) – Number of CPU cores to be used in parallel. By default all cores are used.verbose (
bool
) – UseTrue
to print the overlay progress.
Examples
>>> from eumap.mapper import SpaceOverlay >>> >>> spc_overlay = SpaceOverlay('./my_points.gpkg', ['./raster_dir_1', './raster_dir_2']) >>> result = spc_overlay.run() >>> >>> print(result.shape)
Methods
Execute the space overlay.
- run(dict_newnames={})[source]¶
Execute the space overlay.
- Parameters
dict_newnames (
set
) – A dictionary used to update the column names after the overlay. Thekey
is the new name and thevalue
is the raster file name (without extension).- Returns
Data frame with the original columns plus the overlay result (one new column per raster).
- Return type
geopandas.GeoDataFrame