Affine is a Python library providing matrices that describe two-dimensional affine transformations of the plane. It is commonly used in geospatial contexts, such as with raster data, to transform between image and world coordinates. The current stable version is 2.4.0, with a major rewrite for version 3.0 currently in release candidate stages.
pip install affineVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating identity, translation, scaling, and rotation affine objects, combining them, and applying them to a point.
Update code to treat `Affine` as a regular class instance. For JSON serialization, implement a custom adapter (e.g., by converting to a list or dictionary) or serialize its `to_coeffs()` output.
Access precision settings via `Affine` class or instance attributes. Adjust code that relied on a global `precision` value or the non-exact `is_degenerate` behavior.
Review and update rotation angle values if your application relies on a specific direction of rotation for positive angles.
Ensure your environment uses Python 3.9 or a newer compatible version before upgrading to `affine` 3.0.
Always consider the coordinate system conventions (e.g., 'pixel corner' vs 'pixel center', Y-axis direction) when applying or interpreting affine transforms for geospatial data. Tools like `Affine.from_gdal()` can help convert standard GDAL geotransforms.
Install the 'affine' library using pip: 'pip install affine'.
Import the 'Affine' class correctly: 'from affine import Affine'.
Create a new 'Affine' object with the desired modifications instead of modifying the existing one.
Use `raster.transform` instead of `raster.affine`. For example, if `raster = rasterio.open(...)`, use `affine_transform = raster.transform`.
Install the package using pip: `pip install affine`.
No dependency data recorded yet.