Bug report #11864

wfs parsing of decimal value results in QString

Added by Maarten Pronk about 10 years ago. Updated almost 9 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Web Services clients/WFS
Affected QGIS version:2.6.0 Regression?:No
Operating System:Linux, Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:20079

Description

When opening a (gml) WFS layer from geoserver with values such as:

0.01206198041412

the resulting field seen in the properties of the layer is:

Type QString
Type name xsd:decimal

This prevents certain operations on the field, which is interpreted as a string.

The WFS 2.0 plugin does parse the values correctly, as type double, type name Real.

Associated revisions

Revision 97b8a72b
Added by Roel Huybrechts almost 9 years ago

Interpret 'decimal' fields as double in WFS provider.

Fixes #11864.

History

#1 Updated by Roel Huybrechts almost 9 years ago

I think this can be fixed by adding 'decimal' to the checks in qgswfsprovider?

diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp
index c728930..55b2db4 100644
--- a/src/providers/wfs/qgswfsprovider.cpp
+++ b/src/providers/wfs/qgswfsprovider.cpp
@@ -972,7 +972,7 @@ int QgsWFSProvider::readAttributesFromSchema( QDomDocument& schemaDoc, QString&
     else //todo: distinguish between numerical and non-numerical types
     {
       QVariant::Type  attributeType = QVariant::String; //string is default type
-      if ( type.contains( "double", Qt::CaseInsensitive ) || type.contains( "float", Qt::CaseInsensitive ) )
+      if ( type.contains( "double", Qt::CaseInsensitive ) || type.contains( "float", Qt::CaseInsensitive ) || type.contains( "decimal", Qt::CaseInsensitive ) )
       {
         attributeType = QVariant::Double;
       }

#2 Updated by Roel Huybrechts almost 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF