```python import rasterio import geopandas as gpd # 读取地类图斑图层 dltb = gpd.read_file('data3/dltb.shp') # 读取栅格影像图层 image = rasterio.open('data3/image.tif') # 根据权属性质字段的不同,分别提取31(组集体)、32(村集体)、33(镇集体)的影像 group_image = image.read(1)[dltb[dltb['qsdw'] == '31'].geometry.values] village_image = image.read(1)[dltb[dltb['qsdw'] == '32'].geometry.values] town_image = image.read(1)[dltb[dltb['qsdw'] == '33'].geometry.values] # 保存提取出的影像 with rasterio.open('data3/group_image.tif', 'w', image.profile) as dst: dst.write(group_image, 1) with rasterio.open('data3/village_image.tif', 'w', image.profile) as dst: dst.write(village_image, 1) with rasterio.open('data3/town_image.tif', 'w', image.profile) as dst: dst.write(town_image, 1) ``` [2024-06-30 05:32:46 | AI写代码神器 | 545点数解答]