polartoolkit.square_around_region

polartoolkit.square_around_region#

square_around_region(region, factor=1)[source]#

Get a square region around a supplied region, by expanding the smaller dimension to match the larger one and optionally scaling it by a multiple of the larger dimension. For example, a 50 x 100 km region would expanded to be 100 x 100 km, and with a factor of 5 would be expanded to a 500 x 500 km region, both centered on the same point as the original region.

Parameters:
  • region (tuple[float, float, float, float]) – bounding region in format [xmin, xmax, ymin, ymax]

  • factor (float) – factor to expand the encompassing square region by, by default 1

Returns:

square bounding region in format [xmin, xmax, ymin, ymax]

Return type:

tuple[float, float, float, float]