参数传入的Polygon 图形坐标
#demo_string="722812.922144461772405 4479018.211012263782322,722806.479693785076961 4479018.211012263782322,723089.947523561189882 4479008.547336248680949,723099.611199576291256 4478660.654999705031514, 722816.143369800178334 4478670.318675720132887,722812.922144461772405 4479018.211012263782322 "
raster_file 栅格文件路径
out_path 输出路径
name 输出文件名称
def clip_raster_from_coorlist(demo_string,raster_file,out_path,name='coord'):
try:
geometry1= coorlisttogeometry(demo_string)
if(geometry1==None):
return
if geometry1.is_empty:
#print(f"Skipping empty geometry for feature {index}")
return 1
# 打开影像文件
print(raster_file)
print("-------------------------------------0----------------------------")