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

fix: support spaces as sperator for vendor-option graphic-margin #988

Merged

Conversation

sebastianfrey
Copy link
Contributor

Closes #987

@@ -1001,7 +1001,7 @@ export class SldStyleParser implements StyleParser<string> {
if (this.withGeoServerVendorOption) {
const graphicFillPadding = getVendorOptionValue(sldSymbolizer, 'graphic-margin');
if (!isNil(graphicFillPadding)) {
fillSymbolizer.graphicFillPadding = graphicFillPadding.split(',').map(numberExpression);
fillSymbolizer.graphicFillPadding = graphicFillPadding.split(/[,\s]/).map(numberExpression);
Copy link
Contributor

Choose a reason for hiding this comment

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

Great catch @sebastianfrey! Turns out GeoServer actually expects only spaces and no commas (validating the style does not show any errors, applying it however does). Could you adjust this accordingly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jansule Adopted the write path for the graphic-margin prop. Is this the change you were looking for?

Copy link
Contributor

@jansule jansule left a comment

Choose a reason for hiding this comment

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

Yes, perfect! Thanks for addressing the remarks @sebastianfrey

@jansule jansule merged commit 4c36a74 into geostyler:main Feb 25, 2025
6 checks passed
@ger-benjamin
Copy link
Member

ger-benjamin commented Feb 25, 2025

Waouh, thanks, I come across this issue right now.
I've no clue why and how I miss it during the implementation, sorry about that!

@ger-benjamin
Copy link
Member

@jansule @sebastianfrey, Do we have a case where we should keep the comma separation notation ? I've seen only doc about value separated by spaces, and not comma.

@sebastianfrey
Copy link
Contributor Author

@ger-benjamin The question is: How did you come up with it? Did you find some sample SLD, which did use comma separated values? Or was it just by mistake?

@sebastianfrey
Copy link
Contributor Author

Ok, digged down the rabbit hole: GeoServer uses Geotools for SLD handling and Geotools only supports spaces for graphic-margin:

https://github.com/geotools/geotools/blob/main/modules/library/render/src/main/java/org/geotools/renderer/VendorOptionParser.java#L102

So it should be safe, remove the comma separated notation.

@ger-benjamin
Copy link
Member

ger-benjamin commented Feb 25, 2025

I work with an older and new parser system. And the old one also added graphic-margin without comma. That's not a version problem or so.
I'm copying the resulting style to ensure GeoServer understand it. Therefor I don't understand how it's possible that I've added commas. That could be a "last minutes" mistake by doing the tests.

Can I open a PR right now to remove the comma support ? And again, sorry, for that...
PR #989

@jansule
Copy link
Contributor

jansule commented Feb 25, 2025

No worries @ger-benjamin, things like these happen. And thanks for catching the missing part in #989. I shouldn't do code reviews in the mornings 😄

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.

GeoServer <sld:VendorOptions name="graphic-margin" /> handling is unstable
3 participants