Bug report #19434

SLD import interprets specific text as decimal in scientific notation

Added by Bo Thomsen over 5 years ago. Updated over 5 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Symbology
Affected QGIS version:3.2 Regression?:No
Operating System:MS Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27262

Description

(Actually, I'm not sure if it's a bug or a feature...)

When importing af SLD style layout file with filter element values and the value ex. looks like this: "4e-003" the value is mis-interpreted as a decimal (in scientific notation) instead of a string

..
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>underelement_kode</ogc:PropertyName>
<ogc:Literal>11a-002</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

The above SLD part is converted to a QGIS style rule like this: underelement_kode = '11a-002'

However this example is misinterpreted

..
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>underelement_kode</ogc:PropertyName>
<ogc:Literal>11e-002</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

It's converted to a QGIS style rule like this: underelement_kode = 0.11

Changing the SLD style element to <ogc:PropertyIsLike> which must have a string value doesn't change the behavior. It will make a rule like this: underelement_kode LIKE '0.11' instead of: underelement_kode LIKE '11a-002'

The example file contains a SLD created from a correct rule-based styling in QGIS with the abovementioned values and exported as a SLD file.
When re-imported into QGIS the style rules for values that can be interpreted as a decimal in scientific notation have changed ("4e-003" --> 0.004)

flade fra QGIS.sld (100 KB) Bo Thomsen, 2018-07-17 02:14 PM

flade fra QGIS.sld (2.86 KB) Bo Thomsen, 2018-07-17 02:58 PM

History

#1 Updated by Bo Thomsen over 5 years ago

Removed a lot of unnecessary rules in example file

Also available in: Atom PDF