Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash if there are no labels on export #149

Open
sjib opened this issue Jun 18, 2024 · 1 comment
Open

Crash if there are no labels on export #149

sjib opened this issue Jun 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@sjib
Copy link
Contributor

sjib commented Jun 18, 2024

Describe the bug

Ein Fehler trat bei der Ausführung von Python-Code auf: 

KeyError: 'crs' 
Traceback (most recent call last):
  File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\gui\__init__.py", line 620, in action_do_export
    qgepdss_export(selection=export_dialog.selected_ids, labels_file=labels_file_path, orientation=eorientation)
  File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\qgepdss\export.py", line 3765, in qgep_export
    geojson_crs_def = labels["crs"]
KeyError: 'crs'


Python-Version: 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] 
QGIS-Version: 3.28.4-Firenze Firenze, fd0fb72ab3 

Python-Pfad:
C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\generate_swmm_inp
C:/PROGRA~1/QGIS 3.28.4/apps/qgis-ltr/./python
C:/Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS 3.28.4/apps/qgis-ltr/./python/plugins
C:\Program Files\QGIS 3.28.4\bin\python39.zip
C:\PROGRA~1\QGIS 3.28.4\apps\Python39\DLLs
C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib
C:\Program Files\QGIS 3.28.4\bin
C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages
C:\PROGRA~1\QGIS 3.28.4\apps\Python39
C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib\site-packages
C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib\site-packages\win32
C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS 3.28.4\apps\Python39\lib\site-packages\Pythonwin
C:/Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Daten/QGEP/testing_importspeed
C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\gui\..\..
C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\gui\..\..
.

To Reproduce
Exact steps to reproduce the behavior:

  1. Select just one reach that has not complete information as eg. levels etc.
  2. Choose export with labels
  3. If no labels are generated then this error appears

Expected behavior
No crash of code in this case

Screenshots / data
If applicable, add screenshots or data to help explain your problem.

Desktop (please complete the following information):

  • QGEP plugin 1.6.1 improved
  • QGEP datamodel version 1.6.2 (in development)
  • QGEP project file version version v.11.0
  • QGIS Version 3.28.4
  • OS Windows 10

Additional context
Add any other context about the problem here.

@sjib sjib added the bug Something isn't working label Jun 18, 2024
@sjib
Copy link
Contributor Author

sjib commented Jun 18, 2024

If the created labels.json looks like this - then there is no "crs" that can be found.

{
"type": "FeatureCollection",
"name": "labels",
"features": [

]
}

to do: check whether this check is correct:

 if labels_count == 0:
                continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant