UMEP-dev / UMEP-processing

GNU General Public License v3.0
8 stars 9 forks source link

Treeplanter Attribute Error "NoneType" when trying to use selected feature #35

Closed dawgermany closed 1 year ago

dawgermany commented 1 year ago

After trying and failing to use a shapefile with one polygon (#34 ) , i tried selecting the polygon and to check "Selected features only" This produces

QGIS version: 3.32.0-Lima
QGIS code revision: b9862de816
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.3.2
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
PDAL version: 2.3.0 (git-version: Release)
Algorithm started at: 2023-07-21T19:07:45
Algorithm 'Outdoor Thermal Comfort: TreePlanter v1.0.1' starting…
Input parameters:
{ 'DIA' : 5, 'END_HOUR' : 15, 'GREEDY_ALGORITHM' : False, 'HEIGHT' : 10, 'INCLUDE_OUTSIDE' : True, 'INPUT_POLYGONLAYER' : QgsProcessingFeatureSourceDefinition('/Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/platz_shp.shp', selectedFeaturesOnly=True, featureLimit=-1, geometryCheck=QgsFeatureRequest.GeometryAbortOnInvalid), 'ITERATIONS' : 2000, 'NTREE' : 3, 'OUTPUT_CDSM' : 'TEMPORARY_OUTPUT', 'OUTPUT_POINTFILE' : 'TEMPORARY_OUTPUT', 'RANDOM_STARTING' : False, 'SOLWEIG_DIR' : '/Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test', 'START_HOUR' : 13, 'TRANS_VEG' : 3, 'TRUNK' : 3, 'TTYPE' : 0 }

Traceback (most recent call last):
File "/Users/USERNAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/postprocessor/treeplanter_algorithm.py", line 242, in processAlgorithm
inputPolygonlayer = self.parameterAsVectorLayer(parameters, self.INPUT_POLYGONLAYER, context).dataProvider().dataSourceUri()
AttributeError: 'NoneType' object has no attribute 'dataProvider'

Execution failed after 0.03 seconds

Loading resulting layers
Algorithm 'Outdoor Thermal Comfort: TreePlanter v1.0.1' finished
nilswallenberg commented 1 year ago

Sorry for the delay. I have uploaded some new code that hopefully fixes your problem. :)

Cheers, Nils