Core
To get started with yirgacheffe you can import data using the following core methods.
read_raster(filename, band=1, ignore_nodata=False)
Open a raster file (e.g., GeoTIFF).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
Path | str
|
Path of raster file to open. |
required |
band
|
int
|
For multi-band rasters, which band to use (defaults to first if not specified). |
1
|
ignore_nodata
|
bool
|
If the GeoTIFF has a NODATA value, don't substitute that value for NaN. |
False
|
Returns:
Type | Description |
---|---|
RasterLayer
|
An layer representing the raster data. |
Examples:
read_shape(filename, projection=None, where_filter=None, datatype=None, burn_value=1)
Open a polygon file (e.g., GeoJSON, GPKG, or ESRI Shape File).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
Path | str
|
Path of vector file to open. |
required |
projection
|
MapProjection | tuple[str, tuple[float, float]] | None
|
The map projection to use. |
None
|
where_filter
|
str | None
|
For use with files with many entries (e.g., GPKG), applies this filter to the data. |
None
|
datatype
|
dtype | None
|
Specify the data type of the raster data generated. |
None
|
burn_value
|
int | float | str
|
The value of each pixel in the polygon. |
1
|
Returns:
Type | Description |
---|---|
VectorLayer
|
An layer representing the vector data. |
Examples:
read_shape_like(filename, like, where_filter=None, datatype=None, burn_value=1)
Open a polygon file (e.g., GeoJSON, GPKG, or ESRI Shape File).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
Path | str
|
Path of vector file to open. |
required |
like
|
YirgacheffeLayer
|
Another layer that has a projection and pixel scale set. This layer will use the same projection and pixel scale as that one. |
required |
where_filter
|
str | None
|
For use with files with many entries (e.g., GPKG), applies this filter to the data. |
None
|
datatype
|
dtype | None
|
Specify the data type of the raster data generated. |
None
|
burn_value
|
int | float | str
|
The value of each pixel in the polygon. |
1
|
Returns:
Type | Description |
---|---|
VectorLayer
|
An layer representing the vector data. |
read_rasters(filenames, tiled=False)
Open a set of raster files (e.g., GeoTIFFs) as a single layer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filenames
|
Sequence[Path | str]
|
List of paths of raster files to open. |
required |
tiled
|
bool
|
If you know that the rasters for a regular tileset, then setting this flag allows Yirgacheffe to perform certain optimisations that significantly improve performance for this use case. |
False
|
Returns:
Type | Description |
---|---|
GroupLayer
|
An layer representing the raster data. |
Examples:
constant(value)
Generate a layer that has the same value in all pixels regardless of scale, projection, and area.
Generally this should not be necessary unless you must have the constant as the first term in an expression, as Yirgacheffe will automatically convert numbers into constant layers. However if the constant is the first term in the expression it must be wrapped by this call otherwise Python will not know that it should be part of the Yirgacheffe expression.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
int | float
|
The value to be in each pixel of the expression term. |
required |
Returns:
Type | Description |
---|---|
ConstantLayer
|
A constant layer of the provided value. |