[QGIS-Developer] pyqgis standalone script Unable to execute algorithm Input layers do not have the same grid extent
Xristos Xristoou
saxri89 at gmail.com
Tue Oct 31 15:41:27 PDT 2017
hello I create a simple pyqgis standalone script and I have some errors
with some datasets and I don't know why some times script work fine some
times script show me error :
TypeError: 'NoneType' object has no attribute '__getitem__'
that is because SAGA algorithm SAGA FLOW WIDTH AND SPECIFIC CATCHMENT AREA 1
don't work correct for some datasets for other raster datasets work fine
and I don't know why with the half dataset work and other not working.
and specific message in pycharm :
..\..\..\..\..\src\core\qgsmessagelog.cpp(45) :
(QgsMessageLog::logMessage) [31ms] 2017-11-01T00:03:06 Processing[1]
Unable to execute algorithmInput layers do not have the same grid
extent.Unable to execute algorithmInput layers do not have the same
grid extent.
all dataset is in some srs.
I think so and for other SAGA algorithm I have similar problem .
here code :
from __future__ import unicode_literalsimport qgisfrom qgis.core
import QgsApplication,QgsRasterLayerimport sys
qgs = QgsApplication([],
False)QgsApplication.setPrefixPath("C:/OSGeo4W64/apps/qgis-ltr",
True)QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W64/apps/qgis-ltr/python/plugins')import
processingfrom processing.core.Processing import
ProcessingProcessing.initialize()
rasterLyr = QgsRasterLayer(dem_uri, 'spi')
rasterLyr.isValid()
outputs_GDALOGRSLOPE_1 = processing.runalg('gdalogr:slope', rasterLyr,
1.0, True, True, False, 1.0, None)
rasterLyr1 = QgsRasterLayer(outputs_GDALOGRSLOPE_1['OUTPUT'], 'spi1')
rasterLyr1.isValid().....................................
outputs_SAGAFLOWWIDTHANDSPECIFICCATCHMENTAREA_1 = processing.runalg
('saga:flowwidthandspecificcatchmentarea',rasterLyr,outputs_SAGACATCHMENTAREA_1
['CAREA'],0, None, None).....................................
some messages in pycharm editor :
Parameters
Grids: No objectsFiles: "C:path/to/image.tif"Transformation:
yesInterpolation: Nearest Neighbor
loading: C:path/to/image.tif
Driver: GTiffBands: 1Rows: 2523Columns: 3864
Transformation:
x' = 393.147600 + x * 15.000000 + y * 0.000000
y' = 4564.500000 + x * 0.000000 + y * -15.000000
warning: top-to-bottom and left-to-right cell sizes differ.
using cellsize: 15.000000
C:\Users\username\PycharmProjects\ungdal>saga_cmd ta_hydrology
"Catchment Area (Parallel)" -ELEVATION
"C:\Users\usernamen\AppData\Local\Temp\processing7d1c790b04654237b47a304b19a97535\dec292515b8d4b25864383e8cd17f368\C:pathtoimagetif.sgrd"
-Method 0 -CAREA
"C:\Users\username\AppData\Local\Temp\processing7d1c790b04654237b47a304b19a97535\ece26af68ad042bc8a77aa7665ec6cff\CAREA.sdat"
_____________________________________________
library path: C:\OSGeo4W64\apps\saga\modules\ta_hydrology.dll
library name: Terrain Analysis - Hydrology
tool name : Catchment Area (Parallel)
author : O.Conrad (c) 2001-2010, T.Grabs portions (c) 2010
_____________________________________________
Load grid: C:\Users\username\AppData\Local\Temp\processing7d1c790b04654237b47a304b19a97535\dec292515b8d4b25864383e8cd17f368\
C:pathtoimagetif.sgrd...
Parameters
Grid system: 15; 252x 385y; 3933.647600x 4506.000000yElevation:
C:pathtoimagetifSink Routes: <not set>Weight: <not set>Material: <not
set>Target: <not set>Catchment Area: Catchment AreaCatchment Height:
<not set>Catchment Slope: <not set>Total accumulated Material: <not
set>Accumulated Material from _left_ side: <not set>Accumulated
Material from _right_ side: <not set>Step: 1Catchment Aspect: <not
set>Flow Path Length: <not set>Method: Deterministic 8Linear Flow:
noLinear Flow Threshold: 500.000000Linear Flow Threshold Grid: <not
set>Channel Direction: <not set>Convergence: 1.100000
error message:
..\..\..\..\..\src\core\qgsmessagelog.cpp(45) :
(QgsMessageLog::logMessage) [31ms] 2017-11-01T00:03:06 Processing[1]
Unable to execute algorithmInput layers do not have the same grid
extent.Unable to execute algorithmInput layers do not have the same
grid extent.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171101/c9ae86dd/attachment-0001.html>
More information about the QGIS-Developer
mailing list