# Gotchas/常见问题解答¶

## +init=<auth>:<auth_code> should be replaced with <auth>:<auth_code>¶

```>>> from pyproj import CRS
>>> CRS("ESRI:54009")
<Projected CRS: ESRI:54009>
Name: World_Mollweide
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Coordinate Operation:
- name: World_Mollweide
- method: Mollweide
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich

>>> CRS("+init=ESRI:54009")
...
pyproj.exceptions.CRSError: Invalid projection: +init=ESRI:54009 +type=crs: (Internal Proj Error: proj_create: cannot expand +init=ESRI:54009 +type=crs)
```

## 项目（不是一般的经纬度到投影转换器）¶

`Proj` 仅限于在一个基准内转换地理坐标和投影坐标。如果您有经纬度坐标，并且要将其转换为投影，建议使用 `Transformer` 因为它考虑了基准位移。

```>>> from pyproj import CRS
>>> crs_4326 = CRS("WGS84")
>>> crs_4326
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
```

```>>> crs_proj = CRS("EPSG:28992")
>>> crs_proj
<Projected CRS: EPSG:28992>
Name: Amersfoort / RD New
Axis Info [cartesian]:
- X[east]: Easting (metre)
- Y[north]: Northing (metre)
Area of Use:
- name: Netherlands - onshore
- bounds: (3.2, 50.75, 7.22, 53.7)
Coordinate Operation:
- name: RD New
- method: Oblique Stereographic
Datum: Amersfoort
- Ellipsoid: Bessel 1841
- Prime Meridian: Greenwich
>>> crs_proj.datum == crs_4326.datum
False
>>> from pyproj import Transformer
>>> transformer = Transformer.from_crs(crs_4326, crs_proj)
>>> transformer.transform(52.067567, 5.068913)
(133175.3690698233, 453300.86739169655)
```

```>>> from pyproj import Proj
>>> Proj('epsg:28992')(5.068913, 52.067567)
(133148.22970574044, 453192.24450392975)
>>> transg = Transformer.from_crs(crs_proj.geodetic_crs, crs_proj)
>>> transg.transform(52.067567, 5.068913)
(133148.22970574044, 453192.24450392975)
```

## 从Pyproj 1升级到Pyproj 2¶

Pyproj 1样式：

```>>> from functools import partial
>>> from pyproj import Proj, transform
>>> proj_4326 = Proj(init="epsg:4326")
>>> proj_3857 = Proj(init="epsg:3857")
>>> transformer = partial(transform, proj_4326, proj_3857)
>>> transformer(12, 12)
```

Pyproj 2样式：

```>>> from pyproj import Transformer
>>> transformer = Transformer.from_crs("epsg:4326", "epsg:3857")
>>> transformer.transform(12, 12)
```