为什么使用 make_geocube 在 python 中光栅化 shapefile 会得到一个空的 geotiff 文件?

问题描述 投票:0回答:0

当我尝试为属性 CA 栅格化 shapefile(冰图)时,它不起作用。它给了我一个大小为 1 KB 的 geotiff 文件。当我在 QGIS 上打开它时,什么也没有显示,因为它是空的。

import geopandas as gpd
from geocube.api.core import make_geocube

ds = gpd.read_file('cis_SGRDAEA_20110201_pl_a.shp')
ds['CA'] = ds['CA'].astype(float)
grid = make_geocube(vector_data=ds, measurements=['CA'], resolution=(5000,-5000))
grid.CA.rio.to_raster('test.tif')
python geopandas shapefile geotiff rasterize
© www.soinside.com 2019 - 2024. All rights reserved.