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 the dir_layers and regex_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 in regex_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) – Use True 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

run

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. The key is the new name and the value 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