onstove.RasterLayer.read_layer#

RasterLayer.read_layer(path, conn=None, window=None)[source]#

Reads a dataset from a GIS raster data file.

It works as a wrapper method that uses rasterio.open() to read raster data and store the output in the data attribute, the metadata in the meta attribute and the layer path in the path attribute.

Parameters:
path: str, optional

The relative path to the datafile. This file can be of any type that is accepted by geopandas.read_file.

conn: sqlalchemy.engine.Connection or sqlalchemy.engine.Engine, optional

PostgreSQL connection if the layer needs to be read from a database.

Warning

The PostgreSQL database connection is under development for the RasterLayer class and it will be available in future releases.

window: instance of rasterio.windows.Window

A Window is a view from a rectangular subset of a raster. It is used to perform windowed reading of raster layers. This is useful when working with large raster files in order to reduce memory RAM needs or to read only an area of interest from a broader raster layer.