簡體   English   中英

使用arcpy從服務器獲取柵格結果

[英]Getting a raster result from server using arcpy

我正在嘗試獲取以標記圖像文件格式 (TIFF) 形式返回的光柵結果。 默認情況下,使用 getOutput 時,TIFF 將寫入系統的 TEMP 文件夾。

並且為了控制TIFF的位置,我將scratchWorkspace環境設置為一個文件夾。

現在,我想每 0.2 秒檢查一次結果對象的狀態,直到它的值為 4(成功)或更大的 import arcpy import time

# Set the scratchworkspace to a folder.
arcpy.env.scratchWorkspace = "c:/temp/rasteroutput"

# Add a toolbox from a server
arcpy.ImportToolbox("http://flame7/arcgis/services;SlopeByVal", "mytools")

dem = "c:/dems/k_ne_g"

# Run a server tool named RunSlope
result = arcpy.RunSlope_mytools(dem)


# Raster output will be written to the scratchworkspace
outTIFF = result[0]

有什么建議。

每 0.2 秒檢查一次結果對象的狀態,直到其值為 4(成功)或更大

while result.status < 4:
    print result.status
    time.sleep(0.2)

所以你的最終代碼將是這樣的:

import arcpy
import time

# Set the scratchworkspace to a folder.
arcpy.env.scratchWorkspace = "c:/temp/rasteroutput"

# Add a toolbox from a server
arcpy.ImportToolbox("http://flame7/arcgis/services;SlopeByVal", "mytools")

dem = "c:/dems/k_ne_g"

# Run a server tool named RunSlope
result = arcpy.RunSlope_mytools(dem)
while result.status < 4:
    print result.status
    time.sleep(0.2)

# Raster output will be written to the scratchworkspace
outTIFF = result[0]

暫無
暫無

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

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