Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testTransformBounds(self):
bounds = (-74, 42, -73, 43)
with self.assertRaises(TypeError):
bounding.transform(None, {'init': 'epsg:4269'}, bounds)
with self.assertRaises(TypeError):
bounding.transform({'init': 'epsg:4269'}, None, bounds)
a = bounding.transform({'init': 'epsg:4269'}, {'init': 'epsg:3102'}, bounds)
fixture = (43332273.50269379, 15584115.894447982, 44004519.424246654, 16320640.928220816)
for z in zip(a, fixture):
self.assertAlmostEqual(*z, places=5)
def testTransformBounds(self):
bounds = (-74, 42, -73, 43)
with self.assertRaises(TypeError):
bounding.transform(None, {'init': 'epsg:4269'}, bounds)
with self.assertRaises(TypeError):
bounding.transform({'init': 'epsg:4269'}, None, bounds)
a = bounding.transform({'init': 'epsg:4269'}, {'init': 'epsg:3102'}, bounds)
fixture = (43332273.50269379, 15584115.894447982, 44004519.424246654, 16320640.928220816)
for z in zip(a, fixture):
self.assertAlmostEqual(*z, places=5)
self.log.info('reading %s', layer.name)
# Set the input CRS, if not yet set.
self.set_in_crs(layer.crs)
# When we have passed bounds:
if unprojected_bounds:
# Set the output CRS, if not yet set, using unprojected bounds.
self.set_out_crs(unprojected_bounds)
# If we haven't set the projected bounds yet, do that.
if not self.projected_bounds:
self.update_projected_bounds(self.in_crs, self.out_crs, unprojected_bounds, padding)
# Convert global bounds to layer.crs.
bounds = bounding.transform(self.out_crs, layer.crs, self.projected_bounds)
# When we have no passed bounds:
else:
# Set the output CRS, if not yet set, using this layer's bounds.
self.set_out_crs(layer.bounds)
# Extend projection_bounds
self.update_projected_bounds(layer.crs, self.out_crs, layer.bounds, padding)
bounds = layer.bounds
kwargs = self._prepare_layer(layer, path, bounds, **kwargs)
group = tuple(self.feature(f, **kwargs) for _, f in layer.items(bbox=bounds))
return {
'members': group,
'id': kwargs['name'],