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

Layer loading through WFS fails #281

Closed
Gpetrak opened this issue Nov 1, 2024 · 7 comments · Fixed by #296
Closed

Layer loading through WFS fails #281

Gpetrak opened this issue Nov 1, 2024 · 7 comments · Fixed by #296
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Gpetrak
Copy link
Contributor

Gpetrak commented Nov 1, 2024

When a user tries to load a layer through the WFS, sometimes the plugin raises the following error:

Unable to load layer <some layer>: None

Sometimes before crashing QGIS exports the following error:

TypeError: readSld(self, node: QDomNode, errorMessage: str): argument 1 has unexpected type 'NoneType'

which comes from the handle_layer_detail function of the file: seach_result_widget.py, line 250.

It’s worth noting that both WFS versions (1.1.0, 2.0.0) were used. Also the WCS seems to work without a crash (tested with the live demo of GeoNode).

@Gpetrak Gpetrak self-assigned this Nov 1, 2024
@Gpetrak Gpetrak added the bug Something isn't working label Nov 1, 2024
@giohappy
Copy link
Contributor

giohappy commented Nov 6, 2024

I suspect this is still related to the multiple replies without clear predictability. Sometimes they seem related to the time it takes for a request to complete, sometimes related to the clearing of the cache, but it looks confirmed that it doesn't depend on the plugin.

In the case of WFS loading, the style request is performed within the same tasks as the WFS request itself. This might break the logic that pairs the request to the first reply. Maybe here we're handling the first reply for the WFS request but not the one for the style.

Let's investigate and handle this case too.

@giohappy giohappy added this to the 2.0.0 milestone Nov 7, 2024
@Gpetrak
Copy link
Contributor Author

Gpetrak commented Nov 22, 2024

@giohappy finally, I fixed the error: Unable to load layer <some layer>: None . The main problem was that in the current implementation two requests (one the SLD and one for the dataset) were executing from the same task.
Thus, even if WFS worked, after deleting the cache (which causes multiple replies in each request by QGIS) the request of SLD worked but, the request of Dataset didn't return any reply (maybe due to a timeout error).
So, I separated the requests to be executed by two different tasks: One for the SLD and one for the Dataset while the request of SLD starts only when the Dataset task is completed.
After this modification, the error fixed and it works even with multiple replies (after deleting the cache).
I have created a new branch (ISSUE_281) and I will create a PR after fixing the second reported error (the one that QGIS crashes when trying to load an SLD with encoding issues).

@giohappy
Copy link
Contributor

cool @Gpetrak. do you already have a PR?

@Gpetrak
Copy link
Contributor Author

Gpetrak commented Nov 22, 2024

@giohappy I have pushed the fixes in the branch: ISSUE_281. I didn't create yet the PR since I want to solve also the second error that is reported in this issue: the one with QGIS crash after loading a layer with an SLD which includes non-english characters (e.g greek characters). Obviously is an encoding issue. The crash happens in this line:
https://github.com/GeoNode/QGISGeoNodePlugin/blob/main/src/qgis_geonode/styles.py#L49
I'm searching for an elegant way to decode the Stream object before the save() method.

@Gpetrak
Copy link
Contributor Author

Gpetrak commented Nov 22, 2024

@giohappy for the sake of clearness, I think that it is better to open a new ssue for the QGIS crash because it is a completely different error. Thus, I can create the PR for the main issue that we investigated.

@giohappy
Copy link
Contributor

ok @Gpetrak please proceed.

@Gpetrak
Copy link
Contributor Author

Gpetrak commented Nov 22, 2024

Ok @giohappy . I created the PR for this issue and I opened a new issue (#297 ) for the QGIS crash.

@giohappy giohappy linked a pull request Nov 28, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants