How to use the svgis.bounding.pad function in svgis

To help you get started, we’ve selected a few svgis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fitnr / svgis / tests / test_bounding.py View on Github external
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))
github fitnr / svgis / svgis / svgis.py View on Github external
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