在tkinter中使用python剪辑栅格

时间:2016-02-23 20:39:38

标签: python python-2.7 tkinter clipping python-standalone

我仍然是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:

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. 

0 个答案:

没有答案