我正在尝试使用rasterio加载图像,修改ndarray,然后使用与原始图像相同的空间参考系统进行写出。以下函数是我尝试这样做的结果。但输出的geotiff缺少空间参考系统。请问我做错了什么吗?
我已经检查过输入geotiff的crs是有效的('epsg:32611')。
# Function to write out an ndarry as a GeoTIFF using the spatial references of a sample geotif file
def write_GeoTif_like(templet_tif_file, output_ndarry, output_tif_file):
import rasterio
orig = rasterio.open(templet_tif_file)
with rasterio.open(output_tif_file, 'w', driver='GTiff', height=output_ndarry.shape[0],
width=output_ndarry.shape[1], count=1, dtype=output_ndarry.dtype,
crs=orig.crs, transform=orig.transform, nodata=-9999) as dst:
dst.write(output_ndarry, 1)