We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
The <Format> tag is missing when converting from geostyler to SLD.
<Format>
To Reproduce
const { SldStyleParser } = await import("geostyler-sld-parser"); const geostyle = { rules: [ { name: 'MissingFormat', symbolizers: [{kind: "Icon", image: '/path/to/icon.png'}], }, ] } const parser = new SldStyleParser({ builderOptions: { format: true }}); parser.writeStyle(geostyle).then(({ output: sld }) => console.log(sld));
Result:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:se="http://www.opengis.net/se"> <NamedLayer> <Name/> <UserStyle> <Name/> <Title/> <FeatureTypeStyle> <Rule> <Name>MissingFormat</Name> <PointSymbolizer> <Graphic> <ExternalGraphic> <OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/path/to/icon.png"/> </ExternalGraphic> </Graphic> </PointSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor>
Expected behavior
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:se="http://www.opengis.net/se"> <NamedLayer> <Name/> <UserStyle> <Name/> <Title/> <FeatureTypeStyle> <Rule> <Name>MissingFormat</Name> <PointSymbolizer> <Graphic> <ExternalGraphic> <OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/path/to/icon.png"/> <Format>image/png</Format> </ExternalGraphic> </Graphic> </PointSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor>
Additional context Node v20.8.0 Debian geostler-sld-parser v5.1.0
My fix
diff --git a/src/SldStyleParser.ts b/src/SldStyleParser.ts index 0373158..eb0ccfa 100644 --- a/src/SldStyleParser.ts +++ b/src/SldStyleParser.ts @@ -1739,13 +1739,13 @@ export class SldStyleParser implements StyleParser<string> { case 'png': case 'jpeg': case 'gif': - graphic[0][ExternalGraphic][0][Format] = [`image/${iconExt}`]; + graphic[0][ExternalGraphic][1] = { [Format]: [{ '#text': `image/${iconExt}` }] }; break; case 'jpg': - graphic[0][ExternalGraphic][0][Format] = ['image/jpeg']; + graphic[0][ExternalGraphic][1] = { [Format]: [{ '#text': `image/jpeg` }] }; break; case 'svg': - graphic[0][ExternalGraphic][0][Format] = ['image/svg+xml']; + graphic[0][ExternalGraphic][1] = { [Format]: [{ '#text': `image/svg+xml` }] }; break; default: break;
PS: Thank you for your awesome work !!
The text was updated successfully, but these errors were encountered:
Thanks for the info @joserwan!
We actually do provide a format property in geostyler-style (see https://github.com/geostyler/geostyler-style/blob/master/style.ts#L431). However, it seems like we do not use it yet in geostyler-sld-parser.
format
I would suggest to adjust following things:
this.getTagName('format')
Also, it would be great if you could create a Pull Request for this 🚀
Sorry, something went wrong.
Sorry for the delay, I missed the notification.
I'll have a look on that in the next weeks, for now I'm too busy. Thank you for your feedback !
@joserwan are you still planing on providing a PR here? Otherwise we might have the chance to fix this during the next codes sprint.
No branches or pull requests
Bug
Describe the bug
The
<Format>
tag is missing when converting from geostyler to SLD.To Reproduce
Result:
Expected behavior
Additional context
Node v20.8.0
Debian
geostler-sld-parser v5.1.0
My fix
PS: Thank you for your awesome work !!
The text was updated successfully, but these errors were encountered: