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¶
Added in version 2.2.0.
Datum for CRS. If it is a compound CRS it is the horizontal datum.
- ellipsoid¶
returns: The ellipsoid object with associated attributes. :rtype: Ellipsoid
- static from_authority(unicode auth_name, code)¶
Create a Datum from an authority code.
- static from_epsg(code)¶
Create a Datum from an EPSG code.
- static from_json(unicode datum_json_str)¶
Added in version 2.4.0.
Create Datum from a JSON string.
- static from_json_dict(dict datum_dict)¶
Added in version 2.4.0.
Create Datum from a JSON dictionary.
- static from_name(unicode datum_name, unicode auth_name=None, datum_type=None)¶
Added in version 2.5.0.
Create a Datum from a name.
Examples
WGS 84
World Geodetic System 1984
- static from_string(unicode datum_string)¶
Create a Datum from a string.
Examples
DATUM[“World Geodetic System 1984”, ELLIPSOID[“WGS 84”,6378137,298.257223563, LENGTHUNIT[“metre”,1]], ID[“EPSG”,6326]]
World Geodetic System 1984
- classmethod from_user_input(cls, user_input)¶
Added 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.
- 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
- to_json(self, bool pretty=False, int indentation=2)¶
Added in version 2.4.0.
Convert the object to a JSON string.
- to_json_dict(self)¶
Added in version 2.4.0.
Convert the object to a JSON dictionary.
- Return type:
- to_wkt(self, version=WktVersion.WKT2_2019, pretty=False, output_axis_rule=None)¶
Convert the projection to a WKT string.
- Version options:
WKT2_2015
WKT2_2015_SIMPLIFIED
WKT2_2019
WKT2_2019_SIMPLIFIED
WKT1_GDAL
WKT1_ESRI
Added in version 3.6.0: output_axis_rule
- 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.
output_axis_rule (bool, optional, default=None) – If True, it will set the axis rule on any case. If false, never. None for AUTO, that depends on the CRS and version.
- Return type:
CustomDatum¶
- class pyproj.crs.datum.CustomDatum(name: str = 'undefined', ellipsoid: Any = 'WGS 84', prime_meridian: Any = 'Greenwich')[source]¶
Bases:
Datum
Added 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:
name (str, default="undefined") – Name of the datum.
ellipsoid (Any, default="WGS 84") – Anything accepted by
pyproj.crs.Ellipsoid.from_user_input()
or apyproj.crs.datum.CustomEllipsoid
.prime_meridian (Any, default="Greenwich") – Anything accepted by
pyproj.crs.PrimeMeridian.from_user_input()
.
Ellipsoid¶
- class pyproj.crs.Ellipsoid¶
Added in version 2.0.0.
Ellipsoid for CRS
- static from_authority(unicode auth_name, code)¶
Added in version 2.2.0.
Create an Ellipsoid from an authority code.
- static from_epsg(code)¶
Added in version 2.2.0.
Create an Ellipsoid from an EPSG code.
- static from_json(unicode ellipsoid_json_str)¶
Added in version 2.4.0.
Create Ellipsoid from a JSON string.
- static from_json_dict(dict ellipsoid_dict)¶
Added in version 2.4.0.
Create Ellipsoid from a JSON dictionary.
- static from_name(unicode ellipsoid_name, unicode auth_name=None)¶
Added in version 2.5.0.
Create a Ellipsoid from a name.
Examples
WGS 84
- static from_string(unicode ellipsoid_string)¶
Added in version 2.2.0.
Create an Ellipsoid from a string.
Examples
ELLIPSOID[“Airy 1830”,6377563.396,299.3249646, LENGTHUNIT[“metre”,1], ID[“EPSG”,7001]]
WGS 84
- classmethod from_user_input(cls, user_input)¶
Added 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.
- is_exact_same(self, other)¶
Compares projection objects to see if they are exactly the same.
- to_json(self, bool pretty=False, int indentation=2)¶
Added in version 2.4.0.
Convert the object to a JSON string.
- to_json_dict(self)¶
Added in version 2.4.0.
Convert the object to a JSON dictionary.
- Return type:
- to_wkt(self, version=WktVersion.WKT2_2019, pretty=False, output_axis_rule=None)¶
Convert the projection to a WKT string.
- Version options:
WKT2_2015
WKT2_2015_SIMPLIFIED
WKT2_2019
WKT2_2019_SIMPLIFIED
WKT1_GDAL
WKT1_ESRI
Added in version 3.6.0: output_axis_rule
- 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.
output_axis_rule (bool, optional, default=None) – If True, it will set the axis rule on any case. If false, never. None for AUTO, that depends on the CRS and version.
- Return type:
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
Added 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¶
Added in version 2.0.0.
Prime Meridian for CRS
- static from_authority(unicode auth_name, code)¶
Added in version 2.2.0.
Create a PrimeMeridian from an authority code.
- Parameters:
- Return type:
- static from_epsg(code)¶
Added in version 2.2.0.
Create a PrimeMeridian from an EPSG code.
- Parameters:
- Return type:
- static from_json(unicode prime_meridian_json_str)¶
Added in version 2.4.0.
Create PrimeMeridian from a JSON string.
- Parameters:
prime_meridian_json_str (str) – PrimeMeridian JSON string.
- Return type:
- static from_json_dict(dict prime_meridian_dict)¶
Added in version 2.4.0.
Create PrimeMeridian from a JSON dictionary.
- Parameters:
prime_meridian_dict (str) – PrimeMeridian dictionary.
- Return type:
- static from_name(unicode prime_meridian_name, unicode auth_name=None)¶
Added in version 2.5.0.
Create a Prime Meridian from a name.
Examples
Greenwich
- Parameters:
- Return type:
- static from_string(unicode prime_meridian_string)¶
Added in version 2.2.0.
Create an PrimeMeridian from a string.
Examples
PRIMEM[“Greenwich”,0, ANGLEUNIT[“degree”,0.0174532925199433], ID[“EPSG”,8901]]
Greenwich
- Parameters:
prime_meridian_string (str) – prime meridian string.
- Return type:
- classmethod from_user_input(cls, user_input)¶
Added 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.
- is_exact_same(self, other)¶
Compares projection objects to see if they are exactly the same.
- to_json(self, bool pretty=False, int indentation=2)¶
Added in version 2.4.0.
Convert the object to a JSON string.
- to_json_dict(self)¶
Added in version 2.4.0.
Convert the object to a JSON dictionary.
- Return type:
- to_wkt(self, version=WktVersion.WKT2_2019, pretty=False, output_axis_rule=None)¶
Convert the projection to a WKT string.
- Version options:
WKT2_2015
WKT2_2015_SIMPLIFIED
WKT2_2019
WKT2_2019_SIMPLIFIED
WKT1_GDAL
WKT1_ESRI
Added in version 3.6.0: output_axis_rule
- 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.
output_axis_rule (bool, optional, default=None) – If True, it will set the axis rule on any case. If false, never. None for AUTO, that depends on the CRS and version.
- Return type:
CustomPrimeMeridian¶
- class pyproj.crs.datum.CustomPrimeMeridian(longitude: float, name: str = 'undefined')[source]¶
Bases:
PrimeMeridian
Added in version 2.5.0.
Class to build a prime meridian based on a longitude.