mirror of
https://github.com/ARUP-CAS/aiscr-qgis-amcr-viewer.git
synced 2026-06-19 04:12:55 +02:00
Fixed PIAN counting and downloading logic
This commit is contained in:
@@ -79,6 +79,7 @@ def load_amcr_data(canvas, bb, filters=None):
|
||||
MAX_LIMIT = 20000
|
||||
|
||||
seen_ids = set()
|
||||
target_pian_ids_count = 0
|
||||
|
||||
while True:
|
||||
base_params['rows'] = BATCH_AKCE
|
||||
@@ -198,7 +199,10 @@ def load_amcr_data(canvas, bb, filters=None):
|
||||
dj_pian_value = dj_pian.get('id')
|
||||
if dj_pian_value:
|
||||
target_pian_ids.add(dj_pian_value)
|
||||
pian_lookup[dj_pian_value] = dj_meta
|
||||
target_pian_ids_count = target_pian_ids_count+1
|
||||
if dj_pian_value not in pian_lookup:
|
||||
pian_lookup[dj_pian_value] = []
|
||||
pian_lookup[dj_pian_value].append(dj_meta)
|
||||
|
||||
if not target_pian_ids:
|
||||
iface.messageBar().pushMessage("AMCR", f"Nalezeno {len(docs_akce)} akcí, ale žádná nemá geometrii.", level=1)
|
||||
@@ -213,7 +217,7 @@ def load_amcr_data(canvas, bb, filters=None):
|
||||
docs_pian = []
|
||||
BATCH_PIAN = 50
|
||||
|
||||
iface.messageBar().pushMessage("AMCR", f"Akcí: {len(docs_akce)} (z toho {actions_with_geom} s mapou). Stahuji {total_pians} geometrií...", level=1)
|
||||
iface.messageBar().pushMessage("AMCR", f"Akcí: {len(docs_akce)} (z toho {actions_with_geom} s mapou). Stahuji {total_pians} unikátních geometrií, vykresluji {target_pian_ids_count} geometrií...", level=1)
|
||||
|
||||
# Seznam polí pro PIAN
|
||||
fl_pian = ["ident_cely", "pian_typ", "pian_chranene_udaje", "pian_presnost"]
|
||||
@@ -284,7 +288,7 @@ def load_amcr_data(canvas, bb, filters=None):
|
||||
if pid not in pian_lookup:
|
||||
continue
|
||||
|
||||
meta = pian_lookup[pid]
|
||||
metas = pian_lookup[pid]
|
||||
|
||||
# Geometry processing
|
||||
raw = doc.get('pian_chranene_udaje')
|
||||
@@ -308,6 +312,8 @@ def load_amcr_data(canvas, bb, filters=None):
|
||||
if wkt:
|
||||
geom = QgsGeometry.fromWkt(wkt)
|
||||
if geom.isGeosValid():
|
||||
|
||||
for meta in metas:
|
||||
feat = QgsFeature()
|
||||
feat.setGeometry(geom)
|
||||
feat.setAttributes([
|
||||
|
||||
Reference in New Issue
Block a user