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

QGIS2web keeps failing with python errors #1053

Closed
azstumbler opened this issue Mar 11, 2024 · 13 comments
Closed

QGIS2web keeps failing with python errors #1053

azstumbler opened this issue Mar 11, 2024 · 13 comments

Comments

@azstumbler
Copy link

Qgis2web will not return anything, it fails without generating any type of output. I have tried ti with some maps I have use it on previously without any issue and they are now failing. I have also used it with other computers, all with QGIS 3.36.0 and they all failed. I have tried it with older versions on QGIS and versions of qgis2web and it would work just find.

The information below was using a single feature map one with a polygon and another with just a line layer.

QGIS 3.36.0
qgis2web 3.18.2
stack trace qgis2web
python error tab.txt

@andreaordonselli
Copy link
Collaborator

Can you attach your data in a zip?

Another user told me that qgis2web doesn't work with the latest version of QGIS, but I still have to investigate.
It certainly works with the LTR 3.34 version.

@azstumbler
Copy link
Author

azstumbler commented Mar 11, 2024 via email

@andreaordonselli
Copy link
Collaborator

Attaching files via email doesn't work. you should create a zip file and upload it to the github discussion. Thank you.

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Mar 11, 2024

@andreaordonselli, the symbollayer color property value in QGIS 3.36 is something like '190,178,151,255,rgb:0.74509803921568629,0.69803921568627447,0.59215686274509804,1' while the plugin expect it as '190,178,151,255' in

qgis2web/utils.py

Lines 632 to 633 in b7dc3d9

def getRGBAColor(color, alpha):
r, g, b, a = color.split(",")

See https://api.qgis.org/api/qgsfillsymbollayer_8cpp_source.html#l00355, https://api.qgis.org/api/qgscolorutils_8cpp_source.html#l00192

@azstumbler
Copy link
Author

The 2 shp files were in one zip file

@andreaordonselli
Copy link
Collaborator

something is happening that doesn't allow you to attach, I still don't see the zip you upload. send it to me by email info@opengis.it
Thanks

@tomchadwin
Copy link
Collaborator

@andreaordonselli, the symbollayer color property value in QGIS 3.36 is something like '190,178,151,255,rgb:0.74509803921568629,0.69803921568627447,0.59215686274509804,1' while the plugin expect it as '190,178,151,255'

Is this a QGIS breaking API change, @agiudiceandrea?

@andreaordonselli
Copy link
Collaborator

by applying a simple style to the two levels qgis2web has no problems exporting.

openlayers:

image

leaflet:

image

What styles are you applying? can you export your styles in the following way and send them to me?

image

@agiudiceandrea
Copy link
Contributor

@andreaordonselli, the symbollayer color property value in QGIS 3.36 is something like '190,178,151,255,rgb:0.74509803921568629,0.69803921568627447,0.59215686274509804,1' while the plugin expect it as '190,178,151,255'

Is this a QGIS breaking API change, @agiudiceandrea?

@tomchadwin, see: qgis/QGIS#55718 (comment) and subsequent comments.

@andreaordonselli
Copy link
Collaborator

@tomchadwin
@agiudiceandrea
I ask for your advice as an update would make qgis2web incompatible with previous versions of qgis. do I update and define the minimum version of qgis to use, or do I specify that it must be used with versions prior to the latest one, until an ltr version is released?

@tomchadwin
Copy link
Collaborator

tomchadwin commented Mar 18, 2024

@andreaordonselli Wrap new code to try to parse the new format in a try block, and put the existing code which parses the old format in the except clause. Worth adding a comment that the old format is deprecated, so it can be found and removed later.

@andreaordonselli
Copy link
Collaborator

andreaordonselli commented Mar 18, 2024

Thanks for your advice, I solved it by acquiring only the first 4 values ​​and this will work with the old and new qgis.
can it be okay?

def getRGBAColor(color, alpha):
    r, g, b, a = color.split(",")[:4]
    a = (float(a) / 255) * alpha
    return "'rgba(%s)'" % ",".join([r, g, b, str(a)])

@tomchadwin
Copy link
Collaborator

Looks good to me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants