gemgis.raster.reproject_raster#

gemgis.raster.reproject_raster(path_in: str, path_out: str, dst_crs: Union[str, pyproj.crs.crs.CRS, rasterio.crs.CRS], overwrite_file: bool = False, create_directory: bool = False)#

Reprojecting a raster into different CRS

Parameters
  • path_in (str) – Path to the source file, e.g. path_in='Images/'

  • path_out (str) – Path for the destination file, e.g. path_out='Images/'

  • dst_crs (Union[str, pyproj.crs.crs.CRS, rasterio.crs.CRS]) – CRS of the destination file, e.g. dst_crs='EPSG:25832'

  • overwrite_file (bool) – Variable to overwrite an already existing file. Options include: True or False, default set to False

  • create_directory (bool) – Variable to create a new directory of directory does not exist Options include: True or False, default set to False

New in version 1.0.x.

Changed in version 1.1: Fixing an issue where the file would be closed too soon, see https://github.com/cgre-aachen/gemgis/issues/294

Example

>>> # Loading Libraries
>>> import gemgis as gg
>>> # Reprojecting raster
>>> gg.raster.reproject_raster(path_in='raster_in.tif', path_out='raster_out.tif', dst_crs='EPSG:4326')