Skip to content

Commit

Permalink
fix: update image format handling
Browse files Browse the repository at this point in the history
* Add Format as another item in ExternalGraphic
* fix: $ mistype
  • Loading branch information
tltk90 authored Nov 25, 2024
1 parent e5164c4 commit 0093c6b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/SldStyleParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,7 @@ export class SldStyleParser implements StyleParser<string> {
'@_xmlns:xlink': 'http://www.w3.org/1999/xlink',
'@_xlink:href': iconSymbolizer.image
}
}]
}, {[Format]: []}]
}];

if (typeof iconSymbolizer.image === 'string' || iconSymbolizer.image instanceof String) {
Expand All @@ -1901,13 +1901,19 @@ 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;
Expand Down

0 comments on commit 0093c6b

Please sign in to comment.