gws.lib.crs
¶
Source code: gws.lib.crs
Package Contents¶
- gws.lib.crs.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.
- Parameters:
crs – target CRS
supported_crs – CRS list
- Returns:
A CRS object
- gws.lib.crs.COORDINATE_PRECISION_DEG = 7¶
- gws.lib.crs.COORDINATE_PRECISION_M = 2¶
- gws.lib.crs.get(crs_name: gws.CrsName | None) gws.Crs | None ¶
Returns the CRS for a given CRS-code or SRID.
- class gws.lib.crs.Object(**kwargs)¶
Bases:
gws.Crs
Coordinate reference system.
- 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
- extent_size_in_meters(extent)¶
Calculate the width and height of an extent in meters;
- Parameters:
extent – Extent.
- 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.).
- to_geojson()¶
Return a geojson representation of the CRS (as per GJ2008).
- Returns:
A GeoJson dict.
References
- to_string(fmt=None)¶
Return a string representation of the CRS.
- Parameters:
fmt – Format to use.
- Returns:
A string.
- transform_extent(ext, crs_to)¶
Transform an Extent from this CRS to another.
- Parameters:
extent – Extent.
crs_to – Target CRS.
- Returns:
A transformed Extent.
- transformer(crs_to)¶
Create a transformer function to another CRS.
- Parameters:
crs_to – Target CRS.
- Returns:
A function.
- gws.lib.crs.parse(crs_name: gws.CrsName) tuple[gws.CrsFormat, gws.Crs | None] ¶
Parses a CRS to a tuple of CRS-format and the CRS itself.
- gws.lib.crs.qgis_extent_width(extent: gws.Extent) float ¶
- gws.lib.crs.WEBMERCATOR¶
- gws.lib.crs.WEBMERCATOR_RADIUS = 6378137¶
- gws.lib.crs.WEBMERCATOR_SQUARE¶
- gws.lib.crs.WGS84¶