diff --git a/data/styles/geoserver/poi.ts b/data/styles/geoserver/poi.ts index 67b44de2..ba41324a 100644 --- a/data/styles/geoserver/poi.ts +++ b/data/styles/geoserver/poi.ts @@ -32,7 +32,6 @@ const style: Style = { kind: 'Text', label: '{{NAME}}', color: '#000000', - opacity: 1, haloWidth: 2, haloColor: '#FFFFFF', offset: [ diff --git a/data/styles/geoserver/poly_landmarks.ts b/data/styles/geoserver/poly_landmarks.ts index d71464a0..3e1b8e4b 100644 --- a/data/styles/geoserver/poly_landmarks.ts +++ b/data/styles/geoserver/poly_landmarks.ts @@ -146,7 +146,6 @@ const style: Style = { kind: 'Text', label: '{{LANAME}}', color: '#000000', - opacity: 1, haloWidth: 2, haloColor: '#FDE5A5', haloOpacity: 0.75, diff --git a/data/styles/geoserver/pophatch.ts b/data/styles/geoserver/pophatch.ts index 6143c973..f4d5da56 100644 --- a/data/styles/geoserver/pophatch.ts +++ b/data/styles/geoserver/pophatch.ts @@ -71,7 +71,6 @@ const style: Style = { kind: 'Text', label: '{{STATE_ABBR}}', color: '#000000', - opacity: 1, haloWidth: 2, haloColor: '#FFFFFF', font: [ diff --git a/data/styles/geoserver/popshade.ts b/data/styles/geoserver/popshade.ts index c5749c22..69203fc2 100644 --- a/data/styles/geoserver/popshade.ts +++ b/data/styles/geoserver/popshade.ts @@ -60,7 +60,6 @@ const style: Style = { kind: 'Text', label: '{{STATE_ABBR}}', color: '#000000', - opacity: 1, font: [ 'Times New Roman' ], diff --git a/data/styles/geoserver/tiger_roads.ts b/data/styles/geoserver/tiger_roads.ts index 74af2ee5..73d15f0c 100644 --- a/data/styles/geoserver/tiger_roads.ts +++ b/data/styles/geoserver/tiger_roads.ts @@ -52,7 +52,6 @@ const style: Style = { kind: 'Text', label: '{{NAME}}', color: '#000000', - opacity: 1, haloWidth: 2, haloColor: '#FFFFFF', haloOpacity: 0.85, diff --git a/data/styles/multi_simplelineLabel.ts b/data/styles/multi_simplelineLabel.ts index ea73c967..a2b8d25d 100644 --- a/data/styles/multi_simplelineLabel.ts +++ b/data/styles/multi_simplelineLabel.ts @@ -12,7 +12,6 @@ const multiSimplelineLabel: Style = { }, { kind: 'Text', color: '#000000', - opacity: 1, label: '{{name}}', font: ['Arial'], size: 12, diff --git a/data/styles/point_simpleLabel.ts b/data/styles/point_simpleLabel.ts index 479524e0..a8adee8b 100644 --- a/data/styles/point_simpleLabel.ts +++ b/data/styles/point_simpleLabel.ts @@ -6,7 +6,6 @@ const pointStyledLabel: Style = { name: '', symbolizers: [{ color: '#000000', - opacity: 1, kind: 'Text', label: 'myText' }] diff --git a/data/styles/point_styledLabel_literalPlaceholder.ts b/data/styles/point_styledLabel_literalPlaceholder.ts index c409e68f..c6c23ee5 100644 --- a/data/styles/point_styledLabel_literalPlaceholder.ts +++ b/data/styles/point_styledLabel_literalPlaceholder.ts @@ -14,7 +14,6 @@ const pointStyledLabel: Style = { haloColor: '#000000', haloWidth: 5, haloOpacity: 1, - opacity: 1, rotate: 45, fontStyle: 'normal', fontWeight: 'bold', diff --git a/data/styles/point_styledlabel.ts b/data/styles/point_styledlabel.ts index 5ed122b0..545a06c9 100644 --- a/data/styles/point_styledlabel.ts +++ b/data/styles/point_styledlabel.ts @@ -7,7 +7,6 @@ const pointStyledLabel: Style = { symbolizers: [{ kind: 'Text', color: '#000000', - opacity: 1, label: '{{name}}', font: ['Arial'], size: 12, diff --git a/data/styles/text_lineplacement.ts b/data/styles/text_lineplacement.ts index f1223fee..515c0b8c 100644 --- a/data/styles/text_lineplacement.ts +++ b/data/styles/text_lineplacement.ts @@ -6,7 +6,6 @@ const pointStyledLabel: Style = { name: '', symbolizers: [{ color: '#000000', - opacity: 1, kind: 'Text', label: 'myText', placement: 'line' diff --git a/data/styles/text_pointplacement.ts b/data/styles/text_pointplacement.ts index 4de02e32..efc6ce92 100644 --- a/data/styles/text_pointplacement.ts +++ b/data/styles/text_pointplacement.ts @@ -6,7 +6,6 @@ const pointStyledLabel: Style = { name: '', symbolizers: [{ color: '#000000', - opacity: 1, kind: 'Text', label: 'myText', placement: 'point' diff --git a/src/SldStyleParser.ts b/src/SldStyleParser.ts index 005c2957..9ede263e 100644 --- a/src/SldStyleParser.ts +++ b/src/SldStyleParser.ts @@ -812,7 +812,10 @@ export class SldStyleParser implements StyleParser { } textSymbolizer.color = color ? color : '#000000'; - textSymbolizer.opacity = isNil(opacity) ? 1 : numberExpression(opacity); + + if (!isNil(opacity)) { + textSymbolizer.opacity = numberExpression(opacity); + } const haloRadius = get(sldSymbolizer, 'Halo.Radius.#text'); if (!isNil(haloRadius)) { @@ -2099,15 +2102,17 @@ export class SldStyleParser implements StyleParser { ':@': { '@_name': 'fill' } - }, - { - [CssParameter]: [{ - '#text': Number.isFinite(textSymbolizer.opacity) ? textSymbolizer.opacity : '1', - }], - ':@': { - '@_name': 'fill-opacity' - } }]; + if (Number.isFinite(textSymbolizer.opacity)) { + fill.push({ + [CssParameter]: [{ + '#text': `${textSymbolizer.opacity}`, + }], + ':@': { + '@_name': 'fill-opacity' + }, + }); + } sldTextSymbolizer.push({ [Fill]: fill });