Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testConvertBbox(self):
bounds = (-100, -100, 100, 100)
self.assertSequenceEqual(bounding.pad(bounds, ext=100), (-200, -200, 200, 200))
self.assertSequenceEqual(bounding.pad(bounds, ext=10), (-110, -110, 110, 110))
def update_projected_bounds(self, in_crs, out_crs, bounds, padding=None):
'''
Extend projected_bounds bbox with self.padding.
Args:
in_crs (dict): CRS of bounds.
out_crs (dict) desired output CRS.
bounds (tuple): bounding box.
Returns:
(tuple) bounding box in out_crs coordinates.
'''
# This may happen many times if we were passed bounds, but it's a cheap operation.
projected = bounding.transform(in_crs, out_crs, bounds)
self._projected_bounds = bounding.pad(projected, padding or 0)
return self._projected_bounds