Datum#

Note

PROJ >= 7.0.0 will have better support for aliases for datum names. Until then, you will need to use the full name of the datum. There is support currently for the old PROJ names for datums such as WGS84 and NAD83.

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: The ellipsoid object with associated attributes. :rtype: Ellipsoid

static from_authority(unicode auth_name, code)#

Create a Datum from an authority code.

Parameters:
  • auth_name (str) – Name of the authority.

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

Return type:

Datum

static from_epsg(code)#

Create a Datum from an EPSG code.

Parameters:

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

Return type:

Datum

static from_json(unicode datum_json_str)#

New in version 2.4.0.

Create Datum from a JSON string.

Parameters:

datum_json_str (str) – Datum JSON string.

Return type:

Datum

static from_json_dict(dict datum_dict)#

New in version 2.4.0.

Create Datum from a JSON dictionary.

Parameters:

datum_dict (str) – Datum dictionary.

Return type:

Datum

static from_name(unicode datum_name, unicode auth_name=None, datum_type=None)#

New in version 2.5.0.

Create a Datum from a name.

Examples

  • WGS 84

  • World Geodetic System 1984

Parameters:
  • datum_name (str) – Datum name.

  • auth_name (str, optional) – The authority name to refine search (e.g. ‘EPSG’). If None, will search all authorities.

  • datum_type (DatumType, optional) – The datum type to create. If it is None, it uses any datum type.

Return type:

Datum

static from_string(unicode 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]]

  • World Geodetic System 1984

Parameters:

datum_string (str) – Datum string.

Return type:

Datum

from_user_input(type cls, user_input)#

New in version 2.5.0.

Create cls from user input:
  • PROJ JSON string

  • PROJ JSON dict

  • WKT string

  • An authority string

  • An EPSG integer code

  • An iterable of (“auth_name”, “auth_code”)

  • An object with a to_json method.

Parameters:

user_input (str, dict, int, Iterable[str, str]) – Input to create cls.

Return type:

cls

is_exact_same(self, other)#

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

prime_meridian#

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

remarks#

New in version 2.4.0.

Returns:

Remarks about object.

Return type:

str

scope#

New in version 2.4.0.

Returns:

Scope of object.

Return type:

str

to_json(self, bool pretty=False, int indentation=2)#

New in version 2.4.0.

Convert the object to a JSON string.

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

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

Return type:

str

to_json_dict(self)#

New in version 2.4.0.

Convert the object to a JSON dictionary.

Return type:

dict

to_wkt(self, version=WktVersion.WKT2_2019, pretty=False)#

Convert the projection to a WKT string.

Version options:
  • WKT2_2015

  • WKT2_2015_SIMPLIFIED

  • WKT2_2019

  • WKT2_2019_SIMPLIFIED

  • WKT1_GDAL

  • WKT1_ESRI

Parameters:
  • version (pyproj.enums.WktVersion, default=pyproj.enums.WktVersion.WKT2_2019) – The version of the WKT output.

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

Return type:

str

CustomDatum#

class pyproj.crs.datum.CustomDatum(name: str = 'undefined', ellipsoid: Any = 'WGS 84', prime_meridian: Any = 'Greenwich')[source]#

Bases: Datum

New in version 2.5.0.

Class to build a datum based on an ellipsoid and prime meridian.

static __new__(cls, name: str = 'undefined', ellipsoid: Any = 'WGS 84', prime_meridian: Any = 'Greenwich')[source]#
Parameters:

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

semi_major_metre#

The semi major axis in meters of the ellipsoid.

Type:

float

semi_minor_metre#

The semi minor axis in meters of the ellipsoid.

Type:

float

inverse_flattening#

The inverse flattening of the ellipsoid.

Type:

float

static from_authority(unicode auth_name, code)#

New in version 2.2.0.

Create an Ellipsoid from an authority code.

Parameters:
  • auth_name (str) – Name of the authority.

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

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.

Return type:

Ellipsoid

static from_json(unicode ellipsoid_json_str)#

New in version 2.4.0.

Create Ellipsoid from a JSON string.

Parameters:

ellipsoid_json_str (str) – Ellipsoid JSON string.

Return type:

Ellipsoid

static from_json_dict(dict ellipsoid_dict)#

New in version 2.4.0.

Create Ellipsoid from a JSON dictionary.

Parameters:

ellipsoid_dict (str) – Ellipsoid dictionary.

Return type:

Ellipsoid

static from_name(unicode ellipsoid_name, unicode auth_name=None)#

New in version 2.5.0.

Create a Ellipsoid from a name.

Examples

  • WGS 84

Parameters:
  • ellipsoid_name (str) – Ellipsoid name.

  • auth_name (str, optional) – The authority name to refine search (e.g. ‘EPSG’). If None, will search all authorities.

Return type:

Ellipsoid

static from_string(unicode ellipsoid_string)#

New in version 2.2.0.

Create an Ellipsoid from a string.

Examples

Parameters:

ellipsoid_string (str) – Ellipsoid string.

Return type:

Ellipsoid

from_user_input(type cls, user_input)#

New in version 2.5.0.

Create cls from user input:
  • PROJ JSON string

  • PROJ JSON dict

  • WKT string

  • An authority string

  • An EPSG integer code

  • An iterable of (“auth_name”, “auth_code”)

  • An object with a to_json method.

Parameters:

user_input (str, dict, int, Iterable[str, str]) – Input to create cls.

Return type:

cls

is_exact_same(self, other)#

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

remarks#

New in version 2.4.0.

Returns:

Remarks about object.

Return type:

str

scope#

New in version 2.4.0.

Returns:

Scope of object.

Return type:

str

to_json(self, bool pretty=False, int indentation=2)#

New in version 2.4.0.

Convert the object to a JSON string.

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

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

Return type:

str

to_json_dict(self)#

New in version 2.4.0.

Convert the object to a JSON dictionary.

Return type:

dict

to_wkt(self, version=WktVersion.WKT2_2019, pretty=False)#

Convert the projection to a WKT string.

Version options:
  • WKT2_2015

  • WKT2_2015_SIMPLIFIED

  • WKT2_2019

  • WKT2_2019_SIMPLIFIED

  • WKT1_GDAL

  • WKT1_ESRI

Parameters:
  • version (pyproj.enums.WktVersion, default=pyproj.enums.WktVersion.WKT2_2019) – The version of the WKT output.

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

Return type:

str

CustomEllipsoid#

class pyproj.crs.datum.CustomEllipsoid(name: str = 'undefined', semi_major_axis: float | None = None, inverse_flattening: float | None = None, semi_minor_axis: float | None = None, radius: float | None = None)[source]#

Bases: Ellipsoid

New in version 2.5.0.

Class to build a custom ellipsoid.

static __new__(cls, name: str = 'undefined', semi_major_axis: float | None = None, inverse_flattening: float | None = None, semi_minor_axis: float | None = None, radius: float | None = None)[source]#
Parameters:
  • name (str, default="undefined") – Name of the ellipsoid.

  • semi_major_axis (float, optional) – The semi major axis in meters. Required if missing radius.

  • inverse_flattening (float, optional) – The inverse flattening in meters. Required if missing semi_minor_axis and radius.

  • semi_minor_axis (float, optional) – The semi minor axis in meters. Required if missing inverse_flattening and radius.

  • radius (float, optional) – The radius in meters. Can only be used alone. Cannot be mixed with other parameters.

PrimeMeridian#

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(unicode auth_name, code)#

New in version 2.2.0.

Create a PrimeMeridian from an authority code.

Parameters:
  • auth_name (str) – Name of the authority.

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

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.

Return type:

PrimeMeridian

static from_json(unicode 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.

Return type:

PrimeMeridian

static from_json_dict(dict prime_meridian_dict)#

New in version 2.4.0.

Create PrimeMeridian from a JSON dictionary.

Parameters:

prime_meridian_dict (str) – PrimeMeridian dictionary.

Return type:

PrimeMeridian

static from_name(unicode prime_meridian_name, unicode auth_name=None)#

New in version 2.5.0.

Create a Prime Meridian from a name.

Examples

  • Greenwich

Parameters:
  • prime_meridian_name (str) – Prime Meridian name.

  • auth_name (str, optional) – The authority name to refine search (e.g. ‘EPSG’). If None, will search all authorities.

Return type:

PrimeMeridian

static from_string(unicode prime_meridian_string)#

New in version 2.2.0.

Create an PrimeMeridian from a string.

Examples

Parameters:

prime_meridian_string (str) – prime meridian string.

Return type:

PrimeMeridian

from_user_input(type cls, user_input)#

New in version 2.5.0.

Create cls from user input:
  • PROJ JSON string

  • PROJ JSON dict

  • WKT string

  • An authority string

  • An EPSG integer code

  • An iterable of (“auth_name”, “auth_code”)

  • An object with a to_json method.

Parameters:

user_input (str, dict, int, Iterable[str, str]) – Input to create cls.

Return type:

cls

is_exact_same(self, other)#

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

remarks#

New in version 2.4.0.

Returns:

Remarks about object.

Return type:

str

scope#

New in version 2.4.0.

Returns:

Scope of object.

Return type:

str

to_json(self, bool pretty=False, int indentation=2)#

New in version 2.4.0.

Convert the object to a JSON string.

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

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

Return type:

str

to_json_dict(self)#

New in version 2.4.0.

Convert the object to a JSON dictionary.

Return type:

dict

to_wkt(self, version=WktVersion.WKT2_2019, pretty=False)#

Convert the projection to a WKT string.

Version options:
  • WKT2_2015

  • WKT2_2015_SIMPLIFIED

  • WKT2_2019

  • WKT2_2019_SIMPLIFIED

  • WKT1_GDAL

  • WKT1_ESRI

Parameters:
  • version (pyproj.enums.WktVersion, default=pyproj.enums.WktVersion.WKT2_2019) – The version of the WKT output.

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

Return type:

str

CustomPrimeMeridian#

class pyproj.crs.datum.CustomPrimeMeridian(longitude: float, name: str = 'undefined')[source]#

Bases: PrimeMeridian

New in version 2.5.0.

Class to build a prime meridian based on a longitude.

static __new__(cls, longitude: float, name: str = 'undefined')[source]#
Parameters:
  • longitude (float) – Longitude of prime meridian.

  • name (str, optional) – Name of the prime meridian.