Skip to content

Commit

Permalink
Fixed issue: ParameterBoolean not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxvdwaal committed Oct 14, 2024
1 parent 179652c commit 73f5ece
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 40 deletions.
Binary file modified __pycache__/bgt_loader_algorithm.cpython-312.pyc
Binary file not shown.
82 changes: 42 additions & 40 deletions bgt_loader_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,42 +42,42 @@
class BgtLoaderAlgorithm(QgsProcessingAlgorithm):

layers = [
"bak",
"begroeidterreindeel",
"bord",
"buurt",
"functioneelgebied",
"gebouwinstallatie",
"installatie",
"kast",
"kunstwerkdeel",
"mast",
"onbegroeidterreindeel",
"ondersteunendwaterdeel",
"ondersteunendwegdeel",
"ongeclassificeerdobject",
"openbareruimte",
"openbareruimtelabel",
"overbruggingsdeel",
"overigbouwwerk",
"overigescheiding",
"paal",
"pand",
"plaatsbepalingspunt",
"put",
"scheiding",
"sensor",
"spoor",
"stadsdeel",
"straatmeubilair",
"tunneldeel",
"vegetatieobject",
"waterdeel",
"waterinrichtingselement",
"waterschap",
"wegdeel",
"weginrichtingselement",
"wijk",
'bak',
'begroeidterreindeel',
'bord',
'buurt',
'functioneelgebied',
'gebouwinstallatie',
'installatie',
'kast',
'kunstwerkdeel',
'mast',
'onbegroeidterreindeel',
'ondersteunendwaterdeel',
'ondersteunendwegdeel',
'ongeclassificeerdobject',
'openbareruimte',
'openbareruimtelabel',
'overbruggingsdeel',
'overigbouwwerk',
'overigescheiding',
'paal',
'pand',
'plaatsbepalingspunt',
'put',
'scheiding',
'sensor',
'spoor',
'stadsdeel',
'straatmeubilair',
'tunneldeel',
'vegetatieobject',
'waterdeel',
'waterinrichtingselement',
'waterschap',
'wegdeel',
'weginrichtingselement',
'wijk',
]

OUTPUT_FOLDER = 'OUTPUT_FOLDER'
Expand All @@ -94,7 +94,7 @@ def initAlgorithm(self, config):

self.addParameter(QgsProcessingParameterNumber(
'bbox_growth',
'Bounding Box Growth (meters)',
'Buffer width',
defaultValue=200.0
))

Expand All @@ -103,7 +103,7 @@ def initAlgorithm(self, config):
self.addParameter(
QgsProcessingParameterBoolean(
f"{layer}",
f"{layer.replace('_', ' ').capitalize()}",
f"Include {layer.replace('_', ' ').capitalize()}",
defaultValue=False
)
)
Expand Down Expand Up @@ -133,7 +133,7 @@ def processAlgorithm(self, parameters, context, feedback):
# Verzamel de geselecteerde lagen op basis van de checkboxen
selected_layers = []
for layer in self.layers:
if self.parameterAsBoolean(parameters, f"include_{layer}", context):
if self.parameterAsBoolean(parameters, layer, context):
selected_layers.append(layer)

feedback.pushInfo(f"Geselecteerde lagen: {', '.join(selected_layers)}")
Expand All @@ -153,6 +153,8 @@ def download_geodata(self, wkt_polygon, output_folder, selected_layers, feedback
"featuretypes": selected_layers
}

feedback.pushInfo(f"Payload: {payload}")

try:
response = requests.post(base_url, headers=headers, json=payload)
if response.status_code == 202:
Expand All @@ -174,7 +176,7 @@ def check_status(self, download_request_id, base_url, feedback):
if response.status_code == 201:
return False
elif response.status_code == 200:
time.sleep(10)
time.sleep(5)
else:
feedback.pushInfo(f"Error checking status: {response.status_code}\n{response.text}")
return True
Expand Down

0 comments on commit 73f5ece

Please sign in to comment.