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: 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_name(datum_name, auth_name=None, datum_type=DatumType.GEODETIC_REFERENCE_FRAME)

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. Default is None.

  • datum_type (DatumType, optional) – The datum type to create. Default is DatumType.GEODETIC_REFERENCE_FRAME.

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]]

  • World Geodetic System 1984

Parameters

datum_string (str) – Datum string.

Returns

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

  • A tuple of (“auth_name”: “auth_code”)

  • An object with a to_json method.

Parameters

user_input (str, dict, int) – Intput to create cls.

Returns

Return type

cls

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=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
Returns

str

Return type

The WKT string.

CustomDatum

class pyproj.crs.datum.CustomDatum[source]

Bases: pyproj._crs.Datum

New in version 2.5.0.

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

static __new__(cls, name='undefined', ellipsoid='WGS 84', prime_meridian='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(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_name(ellipsoid_name, 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. Default is None.

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

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

  • A tuple of (“auth_name”: “auth_code”)

  • An object with a to_json method.

Parameters

user_input (str, dict, int) – Intput to create cls.

Returns

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.

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=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
Returns

str

Return type

The WKT string.

CustomEllipsoid

class pyproj.crs.datum.CustomEllipsoid[source]

Bases: pyproj._crs.Ellipsoid

New in version 2.5.0.

Class to build a custom ellipsoid.

static __new__(cls, name='undefined', semi_major_axis=None, inverse_flattening=None, semi_minor_axis=None, radius=None)[source]
Parameters
  • name (str, optional) – Name of the ellipsoid. Default is ‘undefined’.

  • 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(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_name(prime_meridian_name, 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. Default is None.

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

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

  • A tuple of (“auth_name”: “auth_code”)

  • An object with a to_json method.

Parameters

user_input (str, dict, int) – Intput to create cls.

Returns

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.

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=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
Returns

str

Return type

The WKT string.

CustomPrimeMeridian

class pyproj.crs.datum.CustomPrimeMeridian[source]

Bases: pyproj._crs.PrimeMeridian

New in version 2.5.0.

Class to build a prime meridian based on a longitude.

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

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