gws.gis.bounds

Utilities to work with Bounds objects.

Source code: gws.gis.bounds

Package Contents

gws.gis.bounds.buffer(b: gws.Bounds, buf: int) gws.Bounds

Creates a bounds object with buffer to another bounds object.

Parameters:
  • b – A Bounds object.

  • buf – Buffer between b and the output. If buf is positive the returned bounds object will be bigger.

Returns:

A bounds object.

gws.gis.bounds.copy(b: gws.Bounds) gws.Bounds

Copies and creates a new bounds object.

gws.gis.bounds.from_extent(extent: gws.Extent, crs: gws.Crs, always_xy=False) gws.Bounds

Create Bounds from an Extent.

Parameters:
  • extent – An Extent.

  • crs – A Crs object.

  • always_xy – If True, coordinates are assumed to be in the XY (lon/lat) order

Returns:

A Bounds object.

gws.gis.bounds.from_request_bbox(bbox: str, default_crs: gws.Crs = None, always_xy=False) gws.Bounds | None

Create Bounds from a KVP BBOX param.

See OGC 06-121r9, 10.2.3 Bounding box KVP encoding.

Parameters:
  • bbox – A string with four coordinates, optionally followed by a CRS spec.

  • default_crs – Default Crs.

  • always_xy – If True, coordinates are assumed to be in the XY (lon/lat) order

Returns:

A Bounds object.

gws.gis.bounds.intersect(b1: gws.Bounds, b2: gws.Bounds) bool

Returns True if the bounds are intersecting, otherwise False.

gws.gis.bounds.transform(b: gws.Bounds, crs_to: gws.Crs) gws.Bounds

Transforms the bounds object to a different crs.

Parameters:
  • b – Bounds object.

  • crs_to – Output crs.

Returns:

A bounds object.

gws.gis.bounds.union(bs: list[gws.Bounds]) gws.Bounds

Creates the smallest bound that contains all the given bounds.

Parameters:

bs – Bounds.

Returns:

A Bounds object. Its crs is the same as the crs of the first object in bs.