1

我仍然是 python 的新手,除此之外,我试图提出独立的程序来执行几个地理处理过程,即裁剪、创建山体阴影和坡度。我正在使用 Tkinter 为独立设备创建 GUI。我设法想出了以下脚本,无论谁遇到 DLL 模块加载失败的错误。知道如何解决错误吗???

import arcpy
from arcpy import os, sys, time 
import operator
from osgeo import gdal, gdalnumeric, ogr, osr
from Tkinter import *
import tkFileDialog
#import ogr
import subprocess

master = Tk()

inraster = 'F:/practice/data/DEM/srtm_44_13_mau_prj36s.tif'
inshape = 'F:/practice/data/Boundary/eastern_mau.shp'

ds = ogr.Open(inshape)
lyr = ds.GetLayer(0)

lyr.ResetReading()
ft = lyr.GetNextFeature()

while ft:
    country_name = ft.GetFieldAsString('admin')

    outraster = inraster.replace('.tif','_%s.tif'% country_name.replace(' ','_' ))
    subprocess.call(['gdalwarp', inraster, outraster,'-cutline',inshape,'-crop_to_cutline','-cwhere',"'admin'='%s'" % country_name])

    ft = lyr.GetNextFeature()

ds = None

这是回溯:

Traceback (most recent call last):
  File "F:\GIS programming\project scripts\sem proj\gamesGUI.py", line 264, in <module>
    from osgeo import gdal, gdalnumeric, ogr, osr
  File "C:\Python27\ArcGIS10.1\lib\site-packages\osgeo_init_.py", line 21, in <module>
    gdal = swig_import_helper()
  File "C:\Python27\ArcGIS10.1\lib\site-packages\osgeo__init_.py", line 17, in swig_import_helper
         _mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: DLL load failed: The specified module could not be found. 
4

0 回答 0