我想知道是否有一种方法可以转换 geopandas 数据框,类似于 Scikit-image 对 Swirl 所做的事情?
使用 rasterio 的可能解决方案:
def swirl_poly(poly, **kwargs): img = rasterio.features.rasterize([poly], out_shape=(70, 50)) return swirl( # the out_shape to be adjusted ? img, rotation=0, strength=10, radius=60, **kwargs, ).astype("float32")
绘图(参见完整代码):