簡體   English   中英

使用另一個 CRS 從.tif 導出到.tif

[英]Export from .tif to .tif with another CRS

我在 python 中編寫了一段代碼,用於處理 some.tif 文件並將它們放入 WGS 1984 坐標系。 問題是,當我運行代碼時,它給了我錯誤並停止執行。 我嘗試使用 arcpy.ProjectRaster_management 對近 100.tif 文件執行此操作。 你能幫我讓這個腳本運行嗎? 貝婁是我寫的腳本:

import arcpy
import os
import sys
import getpass



username = getpass.getuser()
empty_folder = os.path.expanduser("~") + r"\Desktop\wgs " + str(username)
path1 = empty_folder
if not os.path.exists(path1):
    os.makedirs(path1)


path2 = r"f:\proiecte\F5\Robert Nicolescu\ARCGIS\georeferentiere\TEST_georeferentiere\FINALE\50GHA\global_mapper_export"
tif_files = []
for x in os.listdir(path2):
    if x.endswith(".tif"):
        tif_files.append(x)


input_coordinate_system = "WGS_1984_UTM_zone_29N"
output_coordinate_system = "GCS_WGS_1984"
resampling_technique = "NEAREST"

def projectRaster(input, output):
    arcpy.ProjectRaster_management(input,output,output_coordinate_system,resampling_technique, "","", "", input_coordinate_system)
    print "Script done!"

projectRaster(input=tif_files, output=path1)

在 ArcGIS Desktop 中使用Model Builder ,完成 model 后導出 Python 代碼。 您可以使用 Model Builder 工具來完成您正在嘗試做的事情。 除非你想要一些額外的普通功能,否則你會使用修改后的代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM