I would like to use Gridsplitter plugin in console. I have the following code for doing it:
from qgis.core import *
import qgis.utils
import imp
gridSplitterPath = "C:/Users/Mossy/.qgis2/python/plugins/gridSplitter/gridSplitter.py"
outputpath = "C:/Users/Mossy/Desktop/NewFolder/Output"
cutlayerpath = "C:/Users/Mossy/Desktop/NewFolder/InputData/cutlayer.shp"
layertocutpath = "C:/Users/Mossy/Desktop/NewFolder/InputData/layertocut.tif"
iface = qgis.utils.iface
module = imp.load_source("gridSplitter",gridSplitterPath)
mySplitter = module.gridSplitter(iface)
mySplitter.outputfolder = outputpath
mySplitter.layertocut = QgsRasterLayer(layertocutpath,"laytocut")
mySplitter.cutlayeris = True
mySplitter.cutlayer = QgsVectorLayer(cutlayerpath,"cutlay", "ogr")
mySplitter.pref = "cut_"
mySplitter.subfolderis = False
mySplitter.tileindexis = True
mySplitter.operate()
However, I get the following error:
Traceback (most recent call last):
File "", line 1, in
File "c:/users/Mossy/appdata/local/temp/tmpqc7_fe.py", line 23, in
mySplitter.operate()
File "C:/Users/Mossy/.qgis2/python/plugins/gridSplitter/gridSplitter.py", line 206, in operate
self.layertocutcrs= layertocut.crs()
AttributeError: 'NoneType' object has no attribute 'crs'
Does anybody know how to solve this problem?
No comments:
Post a Comment