bounding

Utilities for working with bounding boxes

svgis.bounding.check(bounds)

Check if bounds are valid.

svgis.bounding.covers(b1, b2)

Check if a bounding box covers another.

Parameters:
  • b1 (tuple) – a bounding box (minx, miny, maxx, maxy)
  • b2 (tuple) – a bounding box
Returns:

False if any points in b2 are outside b1.

Return type:

bool

svgis.bounding.pad(bounds, ext=100)

Pad a bounding box. Works best when input is in a projected unit (i.e. feet or meters).

Parameters:
  • bounds (tuple) – a bounding box (minx, miny, maxx, maxy)
  • ext (int) – the distance to pad the box, in projected units. Default: 100.
Returns:

A bounding box (minx, miny, maxx, maxy)

Return type:

tuple

svgis.bounding.ring(bounds)

Convert min, max points to a boundary ring.

Parameters:bounds (tuple) – a bounding box (minx, miny, maxx, maxy)
Returns:a geojson-like ring of coordinates
Return type:list
svgis.bounding.transform(bounds, **kwargs)

Project a bounding box, taking care to not slice off the sides.

Parameters:
  • bounds (tuple) – bounding box to transform.
  • transformer (pyproj.transformer.Transformer) – A pyproj Transformer instance.
  • in_crs (dict) – Fiona-type proj4 mapping representing input projection.
  • out_crs (dict) – Fiona-type proj4 mapping representing output projection.
Returns:

The input bounds reprojected from in_crs to out_crs

Return type:

tuple

svgis.bounding.update(old, new)

Extend old with any more distant values from newpoints. Also replace any missing min/max points in old with values from new.