示例#1
0
 def __init__(
     self,
     name: str = "undefined",
     datum: Any = "urn:ogc:def:datum:EPSG::6326",
     ellipsoidal_cs: Any = None,
 ) -> None:
     """
     Parameters
     ----------
     name: str, optional
         Name of the CRS. Default is undefined.
     datum: Any, optional
         Anything accepted by :meth:`pyproj.crs.Datum.from_user_input` or
         a :class:`pyproj.crs.datum.CustomDatum`.
     ellipsoidal_cs: Any, optional
         Input to create an Ellipsoidal Coordinate System.
         Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
         or an Ellipsoidal Coordinate System created from :ref:`coordinate_system`.
     """
     geographic_crs_json = {
         "$schema":
         "https://proj.org/schemas/v0.2/projjson.schema.json",
         "type":
         "GeographicCRS",
         "name":
         name,
         "datum":
         Datum.from_user_input(datum).to_json_dict(),
         "coordinate_system":
         CoordinateSystem.from_user_input(
             ellipsoidal_cs or Ellipsoidal2DCS()).to_json_dict(),
     }
     super().__init__(geographic_crs_json)
示例#2
0
    def __init__(self,
                 name,
                 datum,
                 vertical_cs=VerticalCS(),
                 geoid_model=None):
        """
        Parameters
        ----------
        name: str
            The name of the Vertical CRS (e.g. NAVD88 height).
        datum: Any
            Anything accepted by :meth:`pyproj.crs.Datum.from_user_input`
        vertical_cs: Any, optional
            Input to create a Vertical Coordinate System accepted by
            :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or :class:`pyproj.crs.coordinate_system.VerticalCS`
        geoid_model: str, optional
            The name of the GEOID Model (e.g. GEOID12B).
        """
        vert_crs_json = {
            "$schema":
            "https://proj.org/schemas/v0.2/projjson.schema.json",
            "type":
            "VerticalCRS",
            "name":
            name,
            "datum":
            Datum.from_user_input(datum).to_json_dict(),
            "coordinate_system":
            CoordinateSystem.from_user_input(vertical_cs).to_json_dict(),
        }
        if geoid_model is not None:
            vert_crs_json["geoid_model"] = {"name": geoid_model}

        super().__init__(vert_crs_json)