CRS

pyproj.CRS

class pyproj.crs.CRS(projparams=None, **kwargs)[source]

A pythonic Coordinate Reference System manager.

New in version 2.0.0.

The functionality is based on other fantastic projects:

srs

The string form of the user input used to create the CRS.

Type

str

name

The name of the CRS (from proj_get_name).

Type

str

type_name

The name of the type of the CRS object.

Type

str

__init__(projparams=None, **kwargs)[source]
Initialize a CRS class instance with:
  • PROJ string

  • Dictionary of PROJ parameters

  • PROJ keyword arguments for parameters

  • JSON string with PROJ parameters

  • CRS WKT string

  • An authority string [i.e. ‘epsg:4326’]

  • An EPSG integer code [i.e. 4326]

  • A tuple of (“auth_name”: “auth_code”) [i.e (‘epsg’, ‘4326’)]

  • An object with a to_wkt method.

  • A CRS class

Example usage:

>>> from pyproj import CRS
>>> crs_utm = CRS.from_user_input(26915)
>>> crs_utm
<Projected CRS: EPSG:26915>
Name: NAD83 / UTM zone 15N
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: North America - 96°W to 90°W and NAD83 by country
- bounds: (-96.0, 25.61, -90.0, 84.0)
Coordinate Operation:
- name: UTM zone 15N
- method: Transverse Mercator
Datum: North American Datum 1983
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich

>>> crs_utm.area_of_use.bounds
(-96.0, 25.61, -90.0, 84.0)
>>> crs_utm.ellipsoid
ELLIPSOID["GRS 1980",6378137,298.257222101,
    LENGTHUNIT["metre",1],
    ID["EPSG",7019]]
>>> crs_utm.ellipsoid.inverse_flattening
298.257222101
>>> crs_utm.ellipsoid.semi_major_metre
6378137.0
>>> crs_utm.ellipsoid.semi_minor_metre
6356752.314140356
>>> crs_utm.prime_meridian
PRIMEM["Greenwich",0,
    ANGLEUNIT["degree",0.0174532925199433],
    ID["EPSG",8901]]
>>> crs_utm.prime_meridian.unit_name
'degree'
>>> crs_utm.prime_meridian.unit_conversion_factor
0.017453292519943295
>>> crs_utm.prime_meridian.longitude
0.0
>>> crs_utm.datum
DATUM["North American Datum 1983",
    ELLIPSOID["GRS 1980",6378137,298.257222101,
        LENGTHUNIT["metre",1]],
    ID["EPSG",6269]]
>>> crs_utm.coordinate_system
CS[Cartesian,2],
    AXIS["(E)",east,
        ORDER[1],
        LENGTHUNIT["metre",1,
            ID["EPSG",9001]]],
    AXIS["(N)",north,
        ORDER[2],
        LENGTHUNIT["metre",1,
            ID["EPSG",9001]]]
>>> print(crs_utm.coordinate_operation.to_wkt(pretty=True))
CONVERSION["UTM zone 15N",
    METHOD["Transverse Mercator",
        ID["EPSG",9807]],
    PARAMETER["Latitude of natural origin",0,
        ANGLEUNIT["degree",0.0174532925199433],
        ID["EPSG",8801]],
    PARAMETER["Longitude of natural origin",-93,
        ANGLEUNIT["degree",0.0174532925199433],
        ID["EPSG",8802]],
    PARAMETER["Scale factor at natural origin",0.9996,
        SCALEUNIT["unity",1],
        ID["EPSG",8805]],
    PARAMETER["False easting",500000,
        LENGTHUNIT["metre",1],
        ID["EPSG",8806]],
    PARAMETER["False northing",0,
        LENGTHUNIT["metre",1],
        ID["EPSG",8807]],
    ID["EPSG",16015]]
>>> print(crs_utm.to_json(pretty=True))
{
  "$schema": "https://proj.org/schemas/v0.1/projjson.schema.json",
  "type": "ProjectedCRS",
  "name": "NAD83 / UTM zone 15N",
  "base_crs": {
    "name": "NAD83",
    "datum": {
      "type": "GeodeticReferenceFrame",
      "name": "North American Datum 1983",
      "ellipsoid": {
        "name": "GRS 1980",
        "semi_major_axis": 6378137,
        "inverse_flattening": 298.257222101
      }
    },
    "coordinate_system": {
      "subtype": "ellipsoidal",
      "axis": [
        {
          "name": "Geodetic latitude",
          "abbreviation": "Lat",
          "direction": "north",
          "unit": "degree"
        },
        {
          "name": "Geodetic longitude",
          "abbreviation": "Lon",
          "direction": "east",
          "unit": "degree"
        }
      ]
    },
    "id": {
      "authority": "EPSG",
      "code": 4269
    }
  },
  "conversion": {
    "name": "UTM zone 15N",
    "method": {
      "name": "Transverse Mercator",
      "id": {
        "authority": "EPSG",
        "code": 9807
      }
    },
    "parameters": [
      {
        "name": "Latitude of natural origin",
        "value": 0,
        "unit": "degree",
        "id": {
          "authority": "EPSG",
          "code": 8801
        }
      },
      {
        "name": "Longitude of natural origin",
        "value": -93,
        "unit": "degree",
        "id": {
          "authority": "EPSG",
          "code": 8802
        }
      },
      {
        "name": "Scale factor at natural origin",
        "value": 0.9996,
        "unit": "unity",
        "id": {
          "authority": "EPSG",
          "code": 8805
        }
      },
      {
        "name": "False easting",
        "value": 500000,
        "unit": "metre",
        "id": {
          "authority": "EPSG",
          "code": 8806
        }
      },
      {
        "name": "False northing",
        "value": 0,
        "unit": "metre",
        "id": {
          "authority": "EPSG",
          "code": 8807
        }
      }
    ]
  },
  "coordinate_system": {
    "subtype": "Cartesian",
    "axis": [
      {
        "name": "Easting",
        "abbreviation": "E",
        "direction": "east",
        "unit": "metre"
      },
      {
        "name": "Northing",
        "abbreviation": "N",
        "direction": "north",
        "unit": "metre"
      }
    ]
  },
  "area": "North America - 96°W to 90°W and NAD83 by country",
  "bbox": {
    "south_latitude": 25.61,
    "west_longitude": -96,
    "north_latitude": 84,
    "east_longitude": -90
  },
  "id": {
    "authority": "EPSG",
    "code": 26915
  }
}
>>> crs = CRS(proj='utm', zone=10, ellps='WGS84')
>>> print(crs.to_wkt(pretty=True))
PROJCRS["unknown",
    BASEGEOGCRS["unknown",
        DATUM["Unknown based on WGS84 ellipsoid",
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1],
                ID["EPSG",7030]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8901]]],
    CONVERSION["UTM zone 10N",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",-123,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]],
        ID["EPSG",16010]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]]
>>> geod = crs.get_geod()
>>> "+a={:.0f} +f={:.8f}".format(geod.a, geod.f)
'+a=6378137 +f=0.00335281'
>>> crs.is_projected
True
>>> crs.is_geographic
False
area_of_use

returns: AreaOfUse :rtype: The area of use object with associated attributes.

axis_info

returns: list[Axis] :rtype: The list of axis information.

coordinate_operation

New in version 2.2.0.

Returns

CoordinateOperation

Return type

The coordinate operation.

coordinate_system

New in version 2.2.0.

Returns

CoordinateSystem

Return type

The coordinate system.

datum

New in version 2.2.0.

Returns

Datum

Return type

The datum.

ellipsoid

New in version 2.2.0.

Returns

Ellipsoid

Return type

The ellipsoid object with associated attributes.

classmethod from_authority(auth_name, code)[source]

New in version 2.2.0.

Make a CRS from an authority name and authority code

Parameters
  • auth_name (str) – The name of the authority.

  • code (int or str) – The code used by the authority.

Returns

Return type

CRS

classmethod from_cf(in_cf, errcheck=False)[source]

New in version 2.2.0.

This converts a Climate and Forecast (CF) Grid Mapping Version 1.8 dict to a CRS object.

Warning

Parameters may be lost if a mapping from the CF parameter is not found. For best results store the WKT of the projection in the crs_wkt attribute.

Parameters
  • in_cf (dict) – CF version of the projection.

  • errcheck (bool, optional) – If True, will warn when parameters are ignored. Defaults to False.

Returns

Return type

CRS

classmethod from_dict(proj_dict)[source]

New in version 2.2.0.

Make a CRS from a dictionary of PROJ parameters.

Parameters

proj_dict (str) – PROJ params in dict format.

Returns

Return type

CRS

classmethod from_epsg(code)[source]

Make a CRS from an EPSG code

Parameters

code (int or str) – An EPSG code.

Returns

Return type

CRS

classmethod from_json(crs_json)[source]

New in version 2.4.0.

Create CRS from a CRS JSON string.

Parameters

crs_json (str) – CRS JSON string.

Returns

Return type

CRS

classmethod from_json_dict(crs_dict)[source]

New in version 2.4.0.

Create CRS from a JSON dictionary.

Parameters

crs_dict (dict) – CRS dictionary.

Returns

Return type

CRS

classmethod from_proj4(in_proj_string)[source]

New in version 2.2.0.

Make a CRS from a PROJ string

Parameters

in_proj_string (str) – A PROJ string.

Returns

Return type

CRS

classmethod from_string(in_crs_string)[source]

Make a CRS from:

Initialize a CRS class instance with:
  • PROJ string

  • JSON string with PROJ parameters

  • CRS WKT string

  • An authority string [i.e. ‘epsg:4326’]

Parameters

in_crs_string (str) – An EPSG, PROJ, or WKT string.

Returns

Return type

CRS

classmethod from_user_input(value)[source]
Initialize a CRS class instance with:
  • PROJ string

  • Dictionary of PROJ parameters

  • PROJ keyword arguments for parameters

  • JSON string with PROJ parameters

  • CRS WKT string

  • An authority string [i.e. ‘epsg:4326’]

  • An EPSG integer code [i.e. 4326]

  • A tuple of (“auth_name”: “auth_code”) [i.e (‘epsg’, ‘4326’)]

  • An object with a to_wkt method.

  • A CRS class

Parameters

value (obj) – A Python int, dict, or str.

Returns

Return type

CRS

classmethod from_wkt(in_wkt_string)[source]

New in version 2.2.0.

Make a CRS from a WKT string

Parameters

in_wkt_string (str) – A WKT string.

Returns

Return type

CRS

geodetic_crs

New in version 2.2.0.

Returns

pyproj.CRS

Return type

The the geodeticCRS / geographicCRS from the CRS.

get_geod()[source]
Returns

pyproj.geod.Geod

Return type

Geod object based on the ellipsoid.

is_bound

returns: bool :rtype: True if CRS is bound.

is_engineering

New in version 2.2.0.

Returns

bool

Return type

True if CRS is local/engineering.

is_exact_same(self, other)

Compares projection objects to see if they are exactly the same.

is_geocentric

This checks if the CRS is geocentric and takes into account if the CRS is bound.

Returns

bool

Return type

True if CRS is in geocentric (x/y) coordinates.

is_geographic

This checks if the CRS is geographic. It will check if it has a geographic CRS in the sub CRS if it is a compount CRS and will check if the source CRS is geographic if it is a bound CRS.

Returns

bool

Return type

True if the CRS is in geographic (lon/lat) coordinates.

is_projected

This checks if the CRS is projected. It will check if it has a projected CRS in the sub CRS if it is a compount CRS and will check if the source CRS is projected if it is a bound CRS.

Returns

bool

Return type

True if CRS is projected.

is_vertical

New in version 2.2.0.

This checks if the CRS is vertical. It will check if it has a vertical CRS in the sub CRS if it is a compount CRS and will check if the source CRS is vertical if it is a bound CRS.

Returns

bool

Return type

True if CRS is vertical.

prime_meridian

New in version 2.2.0.

Returns

PrimeMeridian

Return type

The CRS prime meridian object with associated attributes.

remarks

New in version 2.4.0.

str: Remarks about object.

scope

New in version 2.4.0.

str: Scope of object.

source_crs

returns: CRS – or the source CRS of a CoordinateOperation. :rtype: The the base CRS of a BoundCRS or a DerivedCRS/ProjectedCRS,

sub_crs_list

If the CRS is a compound CRS, it will return a list of sub CRS objects.

Returns

Return type

list[CRS]

target_crs

New in version 2.2.0.

Returns

CRS

Return type

The hub CRS of a BoundCRS or the target CRS of a CoordinateOperation.

to_authority(self, auth_name=None, min_confidence=70)

New in version 2.2.0.

Return the authority name and code best matching the CRS or None if it a match is not found.

Example:

>>> from pyproj import CRS
>>> ccs = CRS("epsg:4328")
>>> ccs.to_authority()
('EPSG', '4328')

If the CRS is bound, you can get an authority from the source CRS:

>>> from pyproj import CRS
>>> ccs = CRS("+proj=geocent +datum=WGS84 +towgs84=0,0,0")
>>> ccs.to_authority()
>>> ccs.source_crs.to_authority()
('EPSG', '4978')
>>> ccs == CRS.from_authorty('EPSG', '4978')
False
Parameters
Returns

tuple(str, str) or None – matching the confidence level.

Return type

The best matching (<auth_name>, <code>)

to_cf(wkt_version='WKT2_2018', errcheck=False)[source]

New in version 2.2.0.

This converts a CRS object to a Climate and Forecast (CF) Grid Mapping Version 1.8 dict.

Warning

The full projection will be stored in the crs_wkt attribute. However, other parameters may be lost if a mapping to the CF parameter is not found.

Parameters
  • wkt_version (str) – Version of WKT supported by ~CRS.to_wkt.

  • errcheck (bool, optional) – If True, will warn when parameters are ignored. Defaults to False.

Returns

dict

Return type

CF-1.8 version of the projection.

to_dict()[source]

New in version 2.2.0.

Converts the CRS to dictionary of PROJ parameters.

Warning

You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems # noqa: E501

Returns

dict

Return type

PROJ params in dict format.

to_epsg(self, min_confidence=70)

Return the EPSG code best matching the CRS or None if it a match is not found.

Example:

>>> from pyproj import CRS
>>> ccs = CRS("epsg:4328")
>>> ccs.to_epsg()
4328

If the CRS is bound, you can attempt to get an epsg code from the source CRS:

>>> from pyproj import CRS
>>> ccs = CRS("+proj=geocent +datum=WGS84 +towgs84=0,0,0")
>>> ccs.to_epsg()
>>> ccs.source_crs.to_epsg()
4978
>>> ccs == CRS.from_epsg(4978)
False
Parameters

min_confidence (int, optional) – A value between 0-100 where 100 is the most confident. Default is 70. Why does the EPSG code return when using EPSG:xxxx and not with +init=EPSG:xxxx?

Returns

int or None

Return type

The best matching EPSG code matching the confidence level.

to_json(self, pretty=False, indentation=2)

New in version 2.4.0.

Convert the object to a JSON string.

Parameters
  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

  • indentation (int) – If pretty is True, it will set the width of the indentation. Default is 2.

Returns

str

Return type

The JSON string.

to_json_dict(self)

New in version 2.4.0.

Convert the object to a JSON dictionary.

Returns

dict

Return type

The JSON dictionary.

to_proj4(self, version=ProjVersion.PROJ_4)

Convert the projection to a PROJ string.

Warning

You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems

Parameters

version (ProjVersion) – The version of the PROJ string output. Default is PROJ_4.

Returns

str

Return type

The PROJ string.

to_string()[source]

New in version 2.2.0.

Convert the CRS to a string.

It attempts to convert it to the authority string. Otherwise, it uses the string format of the user input to create the CRS.

Returns

str

Return type

String representation of the CRS.

to_wkt(self, version=u'WKT2_2018', pretty=False)

Convert the projection to a WKT string.

Version options:
  • WKT2_2015

  • WKT2_2015_SIMPLIFIED

  • WKT2_2018

  • WKT2_2018_SIMPLIFIED

  • WKT1_GDAL

  • WKT1_ESRI

Parameters
  • version (WktVersion) – The version of the WKT output. Default is WKT2_2018.

  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

Returns

str

Return type

The WKT string.

pyproj.crs.is_wkt

pyproj.crs.is_wkt(proj_string)

New in version 2.0.0.

Check if the input projection string is in the Well-Known Text format.

Parameters

proj_string (str) – The projection string.

Returns

bool

Return type

True if the string is in the Well-Known Text format

pyproj.crs.is_proj

pyproj.crs.is_proj(proj_string)

New in version 2.2.2.

Check if the input projection string is in the PROJ format.

Parameters

proj_string (str) – The projection string.

Returns

bool

Return type

True if the string is in the PROJ format

Area Of Use

class pyproj._crs.AreaOfUse

New in version 2.0.0.

Area of Use for CRS

west

West bound of area of use.

Type

float

south

South bound of area of use.

Type

float

east

East bound of area of use.

Type

float

north

North bound of area of use.

Type

float

name

Name of area of use.

Type

str

Coordinate System

class pyproj._crs.CoordinateSystem

New in version 2.2.0.

Coordinate System for CRS

name

The name of the coordinate system.

Type

str

axis_list

returns: list[Axis] :rtype: The Axis list for the coordinate system.

is_exact_same(self, other)

Compares projection objects to see if they are exactly the same.

remarks

New in version 2.4.0.

str: Remarks about object.

scope

New in version 2.4.0.

str: Scope of object.

to_json(self, pretty=False, indentation=2)

New in version 2.4.0.

Convert the object to a JSON string.

Parameters
  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

  • indentation (int) – If pretty is True, it will set the width of the indentation. Default is 2.

Returns

str

Return type

The JSON string.

to_json_dict(self)

New in version 2.4.0.

Convert the object to a JSON dictionary.

Returns

dict

Return type

The JSON dictionary.

to_wkt(self, version=u'WKT2_2018', pretty=False)

Convert the projection to a WKT string.

Version options:
  • WKT2_2015

  • WKT2_2015_SIMPLIFIED

  • WKT2_2018

  • WKT2_2018_SIMPLIFIED

  • WKT1_GDAL

  • WKT1_ESRI

Parameters
  • version (WktVersion) – The version of the WKT output. Default is WKT2_2018.

  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

Returns

str

Return type

The WKT string.

class pyproj._crs.Axis

New in version 2.0.0.

Coordinate System Axis

name
Type

str

abbrev
Type

str

direction
Type

str

unit_conversion_factor
Type

float

unit_name
Type

str

unit_auth_code
Type

str

unit_code
Type

str

Coordinate Operation

class pyproj.crs.CoordinateOperation

New in version 2.2.0.

Coordinate operation for CRS.

name

The name of the method(projection) with authority information.

Type

str

method_name

The method (projection) name.

Type

str

method_auth_name

The method authority name.

Type

str

method_code

The method code.

Type

str

is_instantiable

If 1, a coordinate operation can be instantiated as a PROJ pipeline. This also checks that referenced grids are available.

Type

int

has_ballpark_transformation

If 1, the coordinate operation has a “ballpark” transformation, that is a very approximate one, due to lack of more accurate transformations.

Type

int

accuracy

The accuracy (in metre) of a coordinate operation.

Type

float

area_of_use

returns: AreaOfUse :rtype: The area of use object with associated attributes.

static from_authority(auth_name, code, use_proj_alternative_grid_names=False)

Create a CoordinateOperation from an authority code.

Parameters
  • auth_name (str) – Name ot the authority.

  • code (str or int) – The code used by the authority.

  • use_proj_alternative_grid_names (bool, optional) – Use the PROJ alternative grid names. Default is False.

Returns

Return type

CoordinateOperation

static from_epsg(code, use_proj_alternative_grid_names=False)

Create a CoordinateOperation from an EPSG code.

Parameters
  • code (str or int) – The code used by EPSG.

  • use_proj_alternative_grid_names (bool, optional) – Use the PROJ alternative grid names. Default is False.

Returns

Return type

CoordinateOperation

static from_json(coordinate_operation_json_str)

Create CoordinateOperation from a JSON string.

New in version 2.4.0.

Parameters

coordinate_operation_json_str (str) – CoordinateOperation JSON string.

Returns

Return type

CoordinateOperation

static from_json_dict(coordinate_operation_dict)

Create CoordinateOperation from a JSON dictionary.

New in version 2.4.0.

Parameters

coordinate_operation_dict (str) – CoordinateOperation dictionary.

Returns

Return type

CoordinateOperation

static from_string(coordinate_operation_string)

Create a CoordinateOperation from a string.

Example

Parameters

coordinate_operation_string (str) – Coordinate operation string.

Returns

Return type

CoordinateOperation

grids

returns: list[Grid] :rtype: The coordinate operation grids.

is_exact_same(self, other)

Compares projection objects to see if they are exactly the same.

operations

New in version 2.4.0.

tuple[CoordinateOperation]: The operations in a concatenated operation.

params

returns: list[Param] :rtype: The coordinate operation parameters.

remarks

New in version 2.4.0.

str: Remarks about object.

scope

New in version 2.4.0.

str: Scope of object.

to_json(self, pretty=False, indentation=2)

New in version 2.4.0.

Convert the object to a JSON string.

Parameters
  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

  • indentation (int) – If pretty is True, it will set the width of the indentation. Default is 2.

Returns

str

Return type

The JSON string.

to_json_dict(self)

New in version 2.4.0.

Convert the object to a JSON dictionary.

Returns

dict

Return type

The JSON dictionary.

to_proj4(self, version=ProjVersion.PROJ_5)

Convert the projection to a PROJ string.

Parameters

version (ProjVersion) – The version of the PROJ string output. Default is PROJ_5.

Returns

str

Return type

The PROJ string.

to_wkt(self, version=u'WKT2_2018', pretty=False)

Convert the projection to a WKT string.

Version options:
  • WKT2_2015

  • WKT2_2015_SIMPLIFIED

  • WKT2_2018

  • WKT2_2018_SIMPLIFIED

  • WKT1_GDAL

  • WKT1_ESRI

Parameters
  • version (WktVersion) – The version of the WKT output. Default is WKT2_2018.

  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

Returns

str

Return type

The WKT string.

towgs84

returns: list(float) – Otherwise an empty list. :rtype: A list of 3 or 7 towgs84 values if they exist.

class pyproj._crs.Param

New in version 2.2.0.

Coordinate operation parameter.

name

The name of the parameter.

Type

str

auth_name

The authority name of the parameter (i.e. EPSG).

Type

str

code

The code of the parameter (i.e. 9807).

Type

str

value

The value of the parameter.

Type

str or double

unit_conversion_factor

The factor to convert to meters.

Type

double

unit_name

The name of the unit.

Type

str

unit_auth_name

The authority name of the unit (i.e. EPSG).

Type

str

unit_code

The code of the unit (i.e. 9807).

Type

str

unit_category

The category of the unit (“unknown”, “none”, “linear”, “angular”, “scale”, “time” or “parametric”).

Type

str

class pyproj._crs.Grid

New in version 2.2.0.

Coordinate operation grid.

short_name

The short name of the grid.

Type

str

full_name

The full name of the grid.

Type

str

package_name

The the package name where the grid might be found.

Type

str

url

The grid URL or the package URL where the grid might be found.

Type

str

direct_download

If 1, url can be downloaded directly.

Type

int

open_license

If 1, the grid is released with an open license.

Type

int

available

If 1, the grid is available at runtime.

Type

int

Datum

class pyproj.crs.Datum

New in version 2.2.0.

Datum for CRS. If it is a compound CRS it is the horizontal datum.

name

The name of the datum.

Type

str

ellipsoid

returns: Ellipsoid :rtype: The ellipsoid object with associated attributes.

static from_authority(auth_name, code)

Create a Datum from an authority code.

Parameters
  • auth_name (str) – Name ot the authority.

  • code (str or int) – The code used by the authority.

Returns

Return type

Datum

static from_epsg(code)

Create a Datum from an EPSG code.

Parameters

code (str or int) – The code used by EPSG.

Returns

Return type

Datum

static from_json(datum_json_str)

New in version 2.4.0.

Create Datum from a JSON string.

Parameters

datum_json_str (str) – Datum JSON string.

Returns

Return type

Datum

static from_json_dict(datum_dict)

New in version 2.4.0.

Create Datum from a JSON dictionary.

Parameters

datum_dict (str) – Datum dictionary.

Returns

Return type

Datum

static from_string(datum_string)

Create a Datum from a string.

Examples

  • urn:ogc:def:datum:EPSG::6326

  • DATUM[“World Geodetic System 1984”, ELLIPSOID[“WGS 84”,6378137,298.257223563, LENGTHUNIT[“metre”,1]], ID[“EPSG”,6326]]

Parameters

datum_string (str) – Datum string.

Returns

Return type

Datum

is_exact_same(self, other)

Compares projection objects to see if they are exactly the same.

prime_meridian

returns: PrimeMeridian :rtype: The CRS prime meridian object with associated attributes.

remarks

New in version 2.4.0.

str: Remarks about object.

scope

New in version 2.4.0.

str: Scope of object.

to_json(self, pretty=False, indentation=2)

New in version 2.4.0.

Convert the object to a JSON string.

Parameters
  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

  • indentation (int) – If pretty is True, it will set the width of the indentation. Default is 2.

Returns

str

Return type

The JSON string.

to_json_dict(self)

New in version 2.4.0.

Convert the object to a JSON dictionary.

Returns

dict

Return type

The JSON dictionary.

to_wkt(self, version=u'WKT2_2018', pretty=False)

Convert the projection to a WKT string.

Version options:
  • WKT2_2015

  • WKT2_2015_SIMPLIFIED

  • WKT2_2018

  • WKT2_2018_SIMPLIFIED

  • WKT1_GDAL

  • WKT1_ESRI

Parameters
  • version (WktVersion) – The version of the WKT output. Default is WKT2_2018.

  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

Returns

str

Return type

The WKT string.

Ellipsoid

class pyproj.crs.Ellipsoid

New in version 2.0.0.

Ellipsoid for CRS

name

The name of the ellipsoid.

Type

str

is_semi_minor_computed

1 if True, 0 if False

Type

int

ellipsoid_loaded

True if it is loaded without errors.

Type

bool

static from_authority(auth_name, code)

New in version 2.2.0.

Create an Ellipsoid from an authority code.

Parameters
  • auth_name (str) – Name ot the authority.

  • code (str or int) – The code used by the authority.

Returns

Return type

Ellipsoid

static from_epsg(code)

New in version 2.2.0.

Create an Ellipsoid from an EPSG code.

Parameters

code (str or int) – The code used by the EPSG.

Returns

Return type

Ellipsoid

static from_json(ellipsoid_json_str)

New in version 2.4.0.

Create Ellipsoid from a JSON string.

Parameters

ellipsoid_json_str (str) – Ellipsoid JSON string.

Returns

Return type

Ellipsoid

static from_json_dict(ellipsoid_dict)

New in version 2.4.0.

Create Ellipsoid from a JSON dictionary.

Parameters

ellipsoid_dict (str) – Ellipsoid dictionary.

Returns

Return type

Ellipsoid

static from_string(ellipsoid_string)

New in version 2.2.0.

Create an Ellipsoid from a string.

Examples

Parameters

ellipsoid_string (str) – Ellipsoid string.

Returns

Return type

Ellipsoid

inverse_flattening

The ellipsoid inverse flattening.

Returns

float or None

Return type

The inverse flattening if the projection is an ellipsoid.

is_exact_same(self, other)

Compares projection objects to see if they are exactly the same.

remarks

New in version 2.4.0.

str: Remarks about object.

scope

New in version 2.4.0.

str: Scope of object.

semi_major_metre

The ellipsoid semi major metre.

Returns

float or None

Return type

The semi major metre if the projection is an ellipsoid.

semi_minor_metre

The ellipsoid semi minor metre.

Returns

float or None – and the value was com puted.

Return type

The semi minor metre if the projection is an ellipsoid

to_json(self, pretty=False, indentation=2)

New in version 2.4.0.

Convert the object to a JSON string.

Parameters
  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

  • indentation (int) – If pretty is True, it will set the width of the indentation. Default is 2.

Returns

str

Return type

The JSON string.

to_json_dict(self)

New in version 2.4.0.

Convert the object to a JSON dictionary.

Returns

dict

Return type

The JSON dictionary.

to_wkt(self, version=u'WKT2_2018', pretty=False)

Convert the projection to a WKT string.

Version options:
  • WKT2_2015

  • WKT2_2015_SIMPLIFIED

  • WKT2_2018

  • WKT2_2018_SIMPLIFIED

  • WKT1_GDAL

  • WKT1_ESRI

Parameters
  • version (WktVersion) – The version of the WKT output. Default is WKT2_2018.

  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

Returns

str

Return type

The WKT string.

Prime Meridian

class pyproj.crs.PrimeMeridian

New in version 2.0.0.

Prime Meridian for CRS

name

The name of the prime meridian.

Type

str

unit_name

The unit name for the prime meridian.

Type

str

static from_authority(auth_name, code)

New in version 2.2.0.

Create a PrimeMeridian from an authority code.

Parameters
  • auth_name (str) – Name ot the authority.

  • code (str or int) – The code used by the authority.

Returns

Return type

PrimeMeridian

static from_epsg(code)

New in version 2.2.0.

Create a PrimeMeridian from an EPSG code.

Parameters

code (str or int) – The code used by EPSG.

Returns

Return type

PrimeMeridian

static from_json(prime_meridian_json_str)

New in version 2.4.0.

Create PrimeMeridian from a JSON string.

Parameters

prime_meridian_json_str (str) – PrimeMeridian JSON string.

Returns

Return type

PrimeMeridian

static from_json_dict(prime_meridian_dict)

New in version 2.4.0.

Create PrimeMeridian from a JSON dictionary.

Parameters

prime_meridian_dict (str) – PrimeMeridian dictionary.

Returns

Return type

PrimeMeridian

static from_string(prime_meridian_string)

New in version 2.2.0.

Create an PrimeMeridian from a string.

Examples

Parameters

prime_meridian_string (str) – prime meridian string.

Returns

Return type

PrimeMeridian

is_exact_same(self, other)

Compares projection objects to see if they are exactly the same.

remarks

New in version 2.4.0.

str: Remarks about object.

scope

New in version 2.4.0.

str: Scope of object.

to_json(self, pretty=False, indentation=2)

New in version 2.4.0.

Convert the object to a JSON string.

Parameters
  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

  • indentation (int) – If pretty is True, it will set the width of the indentation. Default is 2.

Returns

str

Return type

The JSON string.

to_json_dict(self)

New in version 2.4.0.

Convert the object to a JSON dictionary.

Returns

dict

Return type

The JSON dictionary.

to_wkt(self, version=u'WKT2_2018', pretty=False)

Convert the projection to a WKT string.

Version options:
  • WKT2_2015

  • WKT2_2015_SIMPLIFIED

  • WKT2_2018

  • WKT2_2018_SIMPLIFIED

  • WKT1_GDAL

  • WKT1_ESRI

Parameters
  • version (WktVersion) – The version of the WKT output. Default is WKT2_2018.

  • pretty (bool) – If True, it will set the output to be a multiline string. Defaults to False.

Returns

str

Return type

The WKT string.