任务描述:转换投影坐标系为WGC_1984
# -*- coding:utf-8 -*-
''' 用于全球分布图重投影 '''
import arcpy#工作区
arcpy.env.workspace = r"F:\\MODIS_NDVI_Monthly_1km_v006\\tif"#输入栅格
in_raster = 'F:\\MODIS_NDVI_Monthly_1km_v006\\tif\\201001.tif'#输出栅格
out_raster = 'F:\\MODIS_NDVI_Monthly_1km_v006\\tif\\201001_reprojected.tif'#由于我不知道WGC_1984坐标系的标准名字叫什么,因此读取了一个WGC_1984坐标下文件的坐标系名称
dataset = "F:\\Boundary Documents\\WORLD_SHP\\World_Countries\\World_Countries.shp"
mask = arcpy.Describe(dataset).spatialReference
print(mask)##Reproject a TIFF image with Datumn transfer
arcpy.ProjectRaster_management(in_raster, out_raster, mask,\"BILINEAR", "", "", "#", "#")print('Finish!')
输出结果:
<geoprocessing spatial reference object object at 0x1062B8A8>
Finish!
***Repl Closed***
主要是调用了ProjectRaster_management工具和spatialReference工具,可参见:
投影栅格
SpatialReference
I hope this has given you some insight!