遥感影像拼接
Mosaic To New Raster
把数据存到一个文件夹下,作为workspace
修改workspace
修改输出文件路径和文件名
# Set workspace
arcpy.env.workspace = "D://001Landuse//Geodata//RSImage//test"
# 查看数据列表
rslist = arcpy.ListRasters("*", "tif")
print(rslist)
# 循环rasters中的所有影像,进行累加操作
rasters = []
for ii in range(len(rslist)):
rasters.append(rslist[ii])
ras_list = ";".join(rasters)
base = rasters[0]
out_coor_system = arcpy.Describe(base).spatialReference #获取坐标系统
print(out_coor_system)
## Mosaic several TIFF images to a new TIFF image
arcpy.MosaicToNewRaster_management(rasters[:],"D://001Landuse//Geodata//RSImage//test", "arcpy_merge.tif", out_coor_system , "8_BIT_UNSIGNED", "#", 3, "LAST","FIRST")
拼接很慢,耐心等待……
运行完成
2. 遥感影像裁剪
Split Raster手动操作很方便
有兴趣参考官网code sample写一写
https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/split-raster.htm
import arcpy
arcpy.env.workspace = r"\\myServer\PrjWorkspace\RasGP"
##Equally split a large TIFF image by size of images
arcpy.SplitRaster_management("large.tif", "splitras", "size2", "SIZE_OF_TILE",\
"TIFF", "BILINEAR", "#", "3500 3500", "4", "PIXELS",\
"#", "-50 60")