pyproj is a Python interface to PROJ, a powerful C library for cartographic projections and coordinate transformations. It enables precise coordinate reference system (CRS) operations, geodesic computations, and transformation between different spatial reference systems with high accuracy and comprehensive EPSG support. The library is actively maintained with frequent releases, currently at version 3.7.2.
pip install pyprojVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to perform a basic coordinate transformation from WGS84 geographic coordinates (longitude, latitude) to UTM Zone 33N projected coordinates (easting, northing) using `pyproj.CRS` to define the coordinate systems and `pyproj.Transformer` for the transformation. The `always_xy=True` parameter ensures a consistent (x, y) or (longitude, latitude) axis order.
Upgrade your Python environment to 3.11 or newer, or use an older pyproj version compatible with your Python version. (e.g., pyproj 3.6.0 for Python 3.9+, pyproj 3.7.0 for Python 3.10+).
Ensure your system's PROJ installation meets the minimum requirement (PROJ 9.4+). If installing via pip, wheels often bundle PROJ, but if building from source or using conda, verify your PROJ version.
Migrate to `pyproj.CRS` for defining Coordinate Reference Systems and `pyproj.Transformer` for performing transformations. For example, instead of `Proj(init='epsg:4326')`, use `CRS('EPSG:4326')` and `Transformer.from_crs()`.You may need to manually manage PROJ's data directory or install transformation grid packages separately. Consult the pyproj documentation on 'Transformation Grids' for guidance.
Always use `always_xy=True` when creating a `Transformer` instance to ensure consistent (x, y) or (longitude, latitude) input and output order, which aligns with common GIS conventions.
If your code relies on the previous default behavior, explicitly set `return_back_azimuth=False` when calling `fwd_intermediate` or `inv_intermediate`.
pip install pyproj
Replace `pyproj.transform(crs_from, crs_to, x, y)` with `transformer = pyproj.Transformer.from_crs(crs_from, crs_to, always_xy=True); x2, y2 = transformer.transform(x, y)`.
Replace deprecated `+init=epsg:XXXX` with the modern `EPSG:XXXX` string when defining CRSs (e.g., `pyproj.CRS('EPSG:4326')`).For CRS definitions, use `pyproj.CRS()`. For transformations, use `pyproj.Transformer.from_crs()`. If `Proj` is strictly needed, import it explicitly with `from pyproj import Proj`.