gws.gis.crs

Source code: gws.gis.crs

Package Contents

class gws.gis.crs.Object(**kwargs)

Bases: gws.Crs

Coordinate reference system.

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.

to_string(fmt=None)

Return a string representation of the CRS.

Parameters:

fmt – Format to use.

Returns:

A string.

to_geojson()

Return a geojson representation of the CRS (as per GJ2008).

Returns:

A GeoJson dict.

References

https://geojson.org/geojson-spec#named-crs

gws.gis.crs.WGS84
gws.gis.crs.WGS84_BOUNDS
gws.gis.crs.WEBMERCATOR
gws.gis.crs.WEBMERCATOR_BOUNDS
gws.gis.crs.WEBMERCATOR_RADIUS = 6378137
gws.gis.crs.WEBMERCATOR_SQUARE = ()
exception gws.gis.crs.Error

Bases: gws.Error

GWS error.

gws.gis.crs.get(crs_name: gws.CrsName) gws.Crs | None
gws.gis.crs.parse(crs_name: gws.CrsName) tuple[gws.CrsFormat, gws.Crs | None]
gws.gis.crs.require(crs_name: gws.CrsName) gws.Crs
gws.gis.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.gis.crs.best_bounds(crs: gws.Crs, supported_bounds: list[gws.Bounds]) gws.Bounds

Return the best one from the list of supported bounds.

Parameters:
  • crs – target CRS

  • supported_bounds

Returns:

A Bounds object

gws.gis.crs.best_axis(crs: gws.Crs, protocol: gws.OwsProtocol = None, protocol_version: str = None, crs_format: gws.CrsFormat = None, inverted_crs: list[gws.Crs] | None = None) gws.Axis

Return the ‘best guess’ axis under given circumstances.

Parameters:
  • crs – target CRS

  • protocol – OWS protocol (WMS, WFS…)

  • protocol_version – protocol version

  • crs_format – the format the target_crs was obtained from

  • inverted_crs – user-provided list of CRSes known to have an inverted (YX) axis

Returns:

An axis