Bug report #20290

Categorized style classification fails on GeoJSON booleans

Added by Martin Samuelsson almost 2 years ago. Updated almost 2 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Symbology
Affected QGIS version:3.4.0 Regression?:Yes
Operating System:Windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28111

Description

Loading a GeoJSON file (produced by qgis) but adding a property with a boolean value and then setting the styling type of that layer to categorized and then classifying produces style classes that shows no data. QGIS detects the values as bools and I get a drop down in the value column showing tru/false. Removing the automatically classified styles and adding one with value=1 shows the polygons with the property set to true.

Using the following GeoJSON reproduces the issue:

{
"type": "FeatureCollection",
"name": "qgis_boolean_bug",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "bool":true }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 12.561367491202688, 57.265545355012357 ], [ 12.578188838268714, 57.271515650824504 ], [ 12.580543376998371, 57.25634426931056 ], [ 12.561367491202688, 57.265545355012357 ] ] ] } },
{ "type": "Feature", "properties": { "bool":false }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 12.601690134727434, 57.258467784057785 ], [ 12.602218634265689, 57.271240214704655 ], [ 12.620634688693473, 57.266681729179723 ], [ 12.601690134727434, 57.258467784057785 ] ] ] } }
]
}

Using QGIS 2.18.12 automatic classification works but detects the values as 1/0 instead of a real boolean. The problem is the same in 3.4.0 and 3.2.3.

Associated revisions

Revision 645ca2b3
Added by Nyall Dawson almost 2 years ago

[ogr] Fix conversion of boolean values

Fixes #20290

Revision f834a7e2
Added by Nyall Dawson almost 2 years ago

[ogr] Fix conversion of boolean values

Fixes #20290

(cherry picked from commit 645ca2b3510b4226b509a05c212170748bea51e3)

History

#1 Updated by Nyall Dawson almost 2 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF