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
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.
- Returns
- Return type
-
static
from_epsg
(code)¶ Create a Datum from an EPSG code.
- Parameters
code (str or int) – The code used by EPSG.
- Returns
- Return type
-
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
-
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
-
static
from_name
(datum_name, 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
-
static
from_string
(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
- Parameters
datum_string (str) – Datum string.
- Returns
- Return type
-
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: 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, pretty=False, 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.
- Returns
- Return type
str
-
to_json_dict
(self)¶ New in version 2.4.0.
Convert the object to a JSON dictionary.
- Returns
- 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.
- Returns
- Return type
str
-
CustomDatum¶
-
class
pyproj.crs.datum.
CustomDatum
(name: str = 'undefined', ellipsoid: Any = 'WGS 84', prime_meridian: Any = 'Greenwich')[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: 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()
.
-
static
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
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.
- Returns
- Return type
-
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
-
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
-
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
-
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.
- Returns
- Return type
-
static
from_string
(ellipsoid_string)¶ New 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
- Parameters
ellipsoid_string (str) – Ellipsoid string.
- Returns
- Return type
-
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.
- Returns
Remarks about object.
- Return type
str
-
scope
¶ New in version 2.4.0.
- Returns
Scope of object.
- Return type
str
-
to_json
(self, pretty=False, 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.
- Returns
- Return type
str
-
to_json_dict
(self)¶ New in version 2.4.0.
Convert the object to a JSON dictionary.
- Returns
- 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.
- Returns
- Return type
str
-
CustomEllipsoid¶
-
class
pyproj.crs.datum.
CustomEllipsoid
(name: str = 'undefined', semi_major_axis: Optional[float] = None, inverse_flattening: Optional[float] = None, semi_minor_axis: Optional[float] = None, radius: Optional[float] = None)[source]¶ Bases:
pyproj._crs.Ellipsoid
New in version 2.5.0.
Class to build a custom ellipsoid.
-
static
__new__
(cls, name: str = 'undefined', semi_major_axis: Optional[float] = None, inverse_flattening: Optional[float] = None, semi_minor_axis: Optional[float] = None, radius: Optional[float] = 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.
-
static
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
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.
- Returns
- Return type
-
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
-
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
-
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
-
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.
- Returns
- Return type
-
static
from_string
(prime_meridian_string)¶ New 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.
- Returns
- Return type
-
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.
- Returns
Remarks about object.
- Return type
str
-
scope
¶ New in version 2.4.0.
- Returns
Scope of object.
- Return type
str
-
to_json
(self, pretty=False, 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.
- Returns
- Return type
str
-
to_json_dict
(self)¶ New in version 2.4.0.
Convert the object to a JSON dictionary.
- Returns
- 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.
- Returns
- Return type
str
-