image.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:sldc 作者: waliens 项目源码 文件源码
def tile_from_polygon(self, tile_builder, polygon, mask=False):
        """Build a tile being the minimum bounding box around the passed polygon

        Parameters
        ----------
        tile_builder: TileBuilder
            The builder for effectively building the tile
        polygon: shapely.geometry.Polygon
            The polygon of which the bounding tile should be returned
        mask: boolean (optional, default: False)
            True for applying the polygon as an alpha mask to the tile

        Returns
        -------
        tile: Tile
            The bounding tile

        Raises
        ------
        IndexError: if the offset is not inside the image
        TileExtractionException: if the tile cannot be extracted
        """
        offset, width, height = Image.polygon_box(polygon)
        return self.tile(tile_builder, offset, width, height, polygon_mask=polygon if mask else None)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号