I am still a novice in python, besides that am trying to come up with stand alone program to carry out several geoprocessing processes i.e. clipping , creating hillshade and slope. Am using Tkinter to create the GUI for the stand alone. I have managed to come up with the following script , whoever am encountering an error that DLL module load failed. Any idea how I can fix the error ???
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
This is 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.