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

Upload QML (Issue 3433) #3435

Merged
merged 3 commits into from
Oct 14, 2022
Merged

Upload QML (Issue 3433) #3435

merged 3 commits into from
Oct 14, 2022

Conversation

raitisbe
Copy link
Collaborator

@raitisbe raitisbe commented Oct 10, 2022

Description

Support upload of QML in style panel and create a walkaround for invalid WellKnownName problem when parsing qml with geostyler-qml-parser.

Related issues or pull requests

#3433
#3431

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Dependency updates
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe)
  • I am unsure (we'll look into it together)

Do you introduce a breaking change?

  • Yes
  • No
  • I am unsure (no worries, we'll find out)

Checklist

  • I understand and agree that the changes in this PR will be licensed under the [MIT License]
  • I have followed the guidelines for contributing
  • The proposed change fits to the content of the code of conduct
  • I have added or updated tests and documentation, and the test suite passes (run npm test locally)
  • I'm lost; why do I have to check so many boxes? Please help!

@raitisbe raitisbe requested a review from jmacura October 10, 2022 10:39
Copy link
Collaborator

@jmacura jmacura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
This is now in the console, when I start the test-app. I believe it was not there before...

UPDATE: Forgotten npm i

Copy link
Collaborator

@jmacura jmacura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not much has changed regarding #3431
image
Only now when I add the layer "bioregion_pilots" from the data catalogue as WFS, all layers disappear from the map 😱
image

@raitisbe
Copy link
Collaborator Author

raitisbe commented Oct 10, 2022 via email

@jmacura
Copy link
Collaborator

jmacura commented Oct 10, 2022

Yes, getcolor was added back in ol-ext just in the latest ol-ext version. Dicd you npm ci?

Good point. My apologies. I have updated the comments above.

@raitisbe
Copy link
Collaborator Author

Not much has changed regarding #3431 image Only now when I add the layer "bioregion_pilots" from the data catalogue as WFS, all layers disappear from the map scream image

Right, I actually only fixed it when uploading the SLD to style pannel. Not for loading the layer from add-data

@raitisbe
Copy link
Collaborator Author

@jmacura could you retest please?

@jmacura
Copy link
Collaborator

jmacura commented Oct 13, 2022

Sure, will test it later today.

Copy link
Collaborator

@jmacura jmacura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The good news is that the error is gone 👏

This is how the styled layer looks like now.
image
Whereas it should look like this.
image

Not sure if it is an acceptable behaviour 😄

@jmacura
Copy link
Collaborator

jmacura commented Oct 13, 2022

The reason is that the Text Symbolizer is malformed.

The template for displaying the text is
image

whereas the correct formula should be
image

Not sure if we can fix this. I have to check what is actually stored in the layer's style..

@jmacura
Copy link
Collaborator

jmacura commented Oct 13, 2022

And... We can't. There is an issue opened in the geostyler/geostyler-qgis-parser library about it: geostyler/geostyler-qgis-parser#259
Expession based labels are not supported.

From the code in https://github.com/geostyler/geostyler-qgis-parser/blob/ae5203392377d2342ef04a50766eedcdfe5990ec/src/QGISStyleParser.ts#L143 it is quite obvious, that the "fieldName" attribute of the "text-style" element in QML gets misinterpreted as (.

<text-style textColor="51,160,44,255" multilineHeight="1" fieldName="concat(&quot;Country&quot;, ' (', &quot;count&quot;, ')')" fontWeight="87" fontItalic="0" fontStrikeout="0" allowHtml="0" previewBkgrdColor="255,255,255,255" isExpression="1" namedStyle="obyčejné" fontKerning="1" fontSize="10" fontFamily="Arial Black" fontSizeMapUnitScale="3x:0,0,0,0,0,0" blendMode="0" fontLetterSpacing="0" legendString="Aa" fontWordSpacing="0" capitalization="0" useSubstitutions="0" textOrientation="horizontal" fontUnderline="0" textOpacity="1" fontSizeUnit="Point">

image

FTR. Changing the label formatting expression from concat(&quot;Country&quot;, ' (', &quot;count&quot;, ')') to Country || ' (' || count || ')' fixes this other issue and gets parsed correctly by geostyler-qgis-parser. (The TODO note in the code of geostyler/geostyler-qgis-parser https://github.com/geostyler/geostyler-qgis-parser/blob/ae5203392377d2342ef04a50766eedcdfe5990ec/src/QGISStyleParser.ts#L405 is actually obsolete. It DOES support the double pipe syntax. It DOES NOT support any more complex syntax. See issue geostyler/geostyler-qgis-parser#259)

Hence I think this PR is an acceptable fix of #3431 .

Copy link
Collaborator

@jmacura jmacura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind changing the last commit message to something better than "squash", @raitisbe ? 🙏 🙂

Copy link
Collaborator

@jmacura jmacura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thought...
If we will also allow to upload the QML style files along with a new layer in the Datasources panel, will it work out of the box now?
image

@jmacura jmacura changed the title Issue 3433/upload qml Upload QML (Issue 3433) Oct 13, 2022
@raitisbe raitisbe force-pushed the issue-3433/upload-qml branch from e36f0f7 to a9f2e74 Compare October 14, 2022 08:58
Copy link
Collaborator

@jmacura jmacura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also implement the upload of QML along with new vector layer later on.

@raitisbe raitisbe force-pushed the issue-3433/upload-qml branch from ed6b5f8 to f318385 Compare October 14, 2022 10:34
@raitisbe
Copy link
Collaborator Author

long with new vector layer later on.

I did it in this PR, but It had so many changes I'm not sure I haven't broken something... Especially on the upload to Layman side. I think we will need to have some e2e test for this

@raitisbe raitisbe requested a review from jmacura October 14, 2022 10:37
@jmacura
Copy link
Collaborator

jmacura commented Oct 14, 2022

long with new vector layer later on.

I did it in this PR, but It had so many changes I'm not sure I haven't broken something... Especially on the upload to Layman side. I think we will need to have some e2e test for this

Aye. That is what I was afraid of. Actually I started to implement it after our telco today, but then I have realised I am lost, as I do not know the consequences on the Layman side so I have thrown my changes away.
Will test your changes, thanks!

Copy link
Collaborator

@jmacura jmacura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm 🚀
image

@raitisbe raitisbe merged commit 3a99fa4 into develop Oct 14, 2022
@FilipLeitner FilipLeitner deleted the issue-3433/upload-qml branch February 3, 2023 09:14
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

Successfully merging this pull request may close these issues.

2 participants