Skip to content

Commit bede196

Browse files
authoredMay 28, 2019
Merge pull request #29970 from elpaso/bugfix-gh29767-server-wfs-double-virtual-fields
Server WFS fix describefeaturetype double virtual fields
2 parents 575b0de + 49b381f commit bede196

File tree

4 files changed

+740
-1
lines changed

4 files changed

+740
-1
lines changed
 

‎src/server/services/wfs/qgswfsdescribefeaturetype.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ namespace QgsWfs
291291
}
292292
else if ( attributeType == QVariant::Double )
293293
{
294-
if ( field.length() != 0 && field.precision() == 0 )
294+
if ( field.length() > 0 && field.precision() == 0 )
295295
attElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "integer" ) );
296296
else
297297
attElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "decimal" ) );

‎tests/src/python/test_qgsserver_wfs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,13 @@ def test_describeFeatureType(self):
454454
self.wfs_request_compare("DescribeFeatureType", '1.1.0', "TYPENAME=does_not_exist&",
455455
'wfs_describeFeatureType_1_1_0_typename_wrong', project_file=project_file)
456456

457+
def test_describeFeatureTypeVirtualFields(self):
458+
"""Test DescribeFeatureType with virtual fields: bug GH-29767"""
459+
460+
project_file = "bug_gh29767_double_vfield.qgs"
461+
self.wfs_request_compare("DescribeFeatureType", '1.1.0', "",
462+
'wfs_describeFeatureType_1_1_0_virtual_fields', project_file=project_file)
463+
457464
def test_getFeatureFeature_0_nulls(self):
458465
"""Test that 0 and null in integer columns are reported correctly"""
459466

‎tests/testdata/qgis_server/bug_gh29767_double_vfield.qgs

Lines changed: 711 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
Content-Type: text/xml; charset=utf-8
3+
4+
<schema xmlns:gml="http://www.opengis.net/gml" targetNamespace="http://www.qgis.org/gml" xmlns:qgs="http://www.qgis.org/gml" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ogc="http://www.opengis.net/ogc" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
5+
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
6+
<element type="qgs:layer_with_short_nameType" name="layer_with_short_name" substitutionGroup="gml:_Feature"/>
7+
<complexType name="layer_with_short_nameType">
8+
<complexContent>
9+
<extension base="gml:AbstractFeatureType">
10+
<sequence>
11+
<element maxOccurs="1" type="gml:PointPropertyType" minOccurs="0" name="geometry"/>
12+
<element type="long" nillable="true" name="id"/>
13+
<element type="string" nillable="true" name="name"/>
14+
<element type="string" nillable="true" name="utf8nameè"/>
15+
<element type="decimal" nillable="true" name="virtdbl"/>
16+
<element type="int" nillable="true" name="virtint"/>
17+
</sequence>
18+
</extension>
19+
</complexContent>
20+
</complexType>
21+
</schema>

0 commit comments

Comments
 (0)
Please sign in to comment.