:tocdepth: 3 :py:mod:`gws.lib.crs` ===================== .. py:module:: gws.lib.crs **Source code:** :source:`gws.lib.crs` Package Contents ---------------- .. py:function:: best_match(crs: gws.Crs, supported_crs: list[gws.Crs]) -> gws.Crs Return a crs from the list that most closely matches the given crs. :param crs: target CRS :param supported_crs: CRS list :returns: A CRS object .. py:data:: COORDINATE_PRECISION_DEG :value: 7 .. py:data:: COORDINATE_PRECISION_M :value: 2 .. py:exception:: Error Bases: :py:obj:`gws.Error` Generic GWS error. .. py:function:: get(crs_name: Optional[gws.CrsName]) -> Optional[gws.Crs] Returns the CRS for a given CRS-code or SRID. .. py:class:: Object(**kwargs) Bases: :py:obj:`gws.Crs` Coordinate reference system. .. py:method:: axis_for_format(fmt) Get the axis depending on the string format. We adhere to the GeoServer convention here: https://docs.geoserver.org/latest/en/user/services/wfs/axis_order.html .. py:method:: extent_size_in_meters(extent) Calculate the width and height of an extent in meters; :param extent: Extent. .. py:method:: point_offset_in_meters(xy, dist, az) Calculate a point with an offset in meters. :param xy: Point. :param dist: Distance in meters. :param az: Azimuth in degrees (0 = North, 90 = East, etc.). .. py:method:: to_geojson() Return a geojson representation of the CRS (as per GJ2008). :returns: A GeoJson dict. .. rubric:: References https://geojson.org/geojson-spec#named-crs .. py:method:: to_string(fmt=None) Return a string representation of the CRS. :param fmt: Format to use. :returns: A string. .. py:method:: transform_extent(ext, crs_to) Transform an Extent from this CRS to another. :param extent: Extent. :param crs_to: Target CRS. :returns: A transformed Extent. .. py:method:: transformer(crs_to) Create a transformer function to another CRS. :param crs_to: Target CRS. :returns: A function. .. py:function:: parse(crs_name: gws.CrsName) -> tuple[gws.CrsFormat, Optional[gws.Crs]] Parses a CRS to a tuple of CRS-format and the CRS itself. .. py:function:: qgis_extent_width(extent: gws.Extent) -> float .. py:function:: require(crs_name: gws.CrsName) -> gws.Crs Raises an error if no correct CRS is given. .. py:data:: WEBMERCATOR .. py:data:: WEBMERCATOR_RADIUS :value: 6378137 .. py:data:: WEBMERCATOR_SQUARE .. py:data:: WGS84