diff --git a/src/core/geometry/qgsgeometryutils.cpp b/src/core/geometry/qgsgeometryutils.cpp
index afb0dea0eb2..1dc3483a117 100644
--- a/src/core/geometry/qgsgeometryutils.cpp
+++ b/src/core/geometry/qgsgeometryutils.cpp
@@ -877,12 +877,20 @@ QDomElement QgsGeometryUtils::pointsToGML2( const QgsPointSequence &points, QDom
{
QDomElement elemCoordinates = doc.createElementNS( ns, QStringLiteral( "coordinates" ) );
+ // coordinate separator
+ QString cs = ",";
+ // tupel separator
+ QString ts = " ";
+
+ elemCoordinates.setAttribute( "cs", cs );
+ elemCoordinates.setAttribute( "ts", ts );
+
QString strCoordinates;
Q_FOREACH ( const QgsPoint &p, points )
- strCoordinates += qgsDoubleToString( p.x(), precision ) + ',' + qgsDoubleToString( p.y(), precision ) + ' ';
+ strCoordinates += qgsDoubleToString( p.x(), precision ) + cs + qgsDoubleToString( p.y(), precision ) + ts;
- if ( strCoordinates.endsWith( ' ' ) )
+ if ( strCoordinates.endsWith( ts ) )
strCoordinates.chop( 1 ); // Remove trailing space
elemCoordinates.appendChild( doc.createTextNode( strCoordinates ) );
diff --git a/src/core/geometry/qgspoint.cpp b/src/core/geometry/qgspoint.cpp
index 4eef470de84..db775a1c858 100644
--- a/src/core/geometry/qgspoint.cpp
+++ b/src/core/geometry/qgspoint.cpp
@@ -232,7 +232,16 @@ QDomElement QgsPoint::asGML2( QDomDocument &doc, int precision, const QString &n
{
QDomElement elemPoint = doc.createElementNS( ns, QStringLiteral( "Point" ) );
QDomElement elemCoordinates = doc.createElementNS( ns, QStringLiteral( "coordinates" ) );
- QString strCoordinates = qgsDoubleToString( mX, precision ) + ',' + qgsDoubleToString( mY, precision );
+
+ // coordinate separator
+ QString cs = ",";
+ // tupel separator
+ QString ts = " ";
+
+ elemCoordinates.setAttribute( "cs", cs );
+ elemCoordinates.setAttribute( "ts", ts );
+
+ QString strCoordinates = qgsDoubleToString( mX, precision ) + cs + qgsDoubleToString( mY, precision );
elemCoordinates.appendChild( doc.createTextNode( strCoordinates ) );
elemPoint.appendChild( elemCoordinates );
return elemPoint;
diff --git a/tests/src/core/testqgsgeometry.cpp b/tests/src/core/testqgsgeometry.cpp
index d3a3e4cb564..773a5f7317e 100644
--- a/tests/src/core/testqgsgeometry.cpp
+++ b/tests/src/core/testqgsgeometry.cpp
@@ -616,9 +616,9 @@ void TestQgsGeometry::point()
QgsPoint exportPoint( 1, 2 );
QgsPoint exportPointFloat( 1 / 3.0, 2 / 3.0 );
QDomDocument doc( QStringLiteral( "gml" ) );
- QString expectedGML2( QStringLiteral( "1,2" ) );
+ QString expectedGML2( QStringLiteral( "1,2" ) );
QCOMPARE( elemToString( exportPoint.asGML2( doc ) ), expectedGML2 );
- QString expectedGML2prec3( QStringLiteral( "0.333,0.667" ) );
+ QString expectedGML2prec3( QStringLiteral( "0.333,0.667" ) );
QCOMPARE( elemToString( exportPointFloat.asGML2( doc, 3 ) ), expectedGML2prec3 );
//asGML3
@@ -1738,9 +1738,9 @@ void TestQgsGeometry::lineString()
<< QgsPoint( 1 + 1 / 3.0, 1 + 2 / 3.0 )
<< QgsPoint( 2 + 1 / 3.0, 2 + 2 / 3.0 ) );
QDomDocument doc( QStringLiteral( "gml" ) );
- QString expectedGML2( QStringLiteral( "31,32 41,42 51,52" ) );
+ QString expectedGML2( QStringLiteral( "31,32 41,42 51,52" ) );
QCOMPARE( elemToString( exportLine.asGML2( doc ) ), expectedGML2 );
- QString expectedGML2prec3( QStringLiteral( "0.333,0.667 1.333,1.667 2.333,2.667" ) );
+ QString expectedGML2prec3( QStringLiteral( "0.333,0.667 1.333,1.667 2.333,2.667" ) );
QCOMPARE( elemToString( exportLineFloat.asGML2( doc, 3 ) ), expectedGML2prec3 );
//asGML3
@@ -3202,11 +3202,11 @@ void TestQgsGeometry::polygon()
QDomDocument doc( "gml" );
// as GML2
- QString expectedSimpleGML2( "0,0 0,10 10,10 10,0 0,0" );
+ QString expectedSimpleGML2( QStringLiteral( "0,0 0,10 10,10 10,0 0,0" ) );
QCOMPARE( elemToString( exportPolygon.asGML2( doc ) ), expectedSimpleGML2 );
//as GML3
- QString expectedSimpleGML3( "0 0 0 10 10 10 10 0 0 0" );
+ QString expectedSimpleGML3( QStringLiteral( "0 0 0 10 10 10 10 0 0 0" ) );
QCOMPARE( elemToString( exportPolygon.asGML3( doc ) ), expectedSimpleGML3 );
// as JSON
@@ -3238,11 +3238,11 @@ void TestQgsGeometry::polygon()
QCOMPARE( exportPolygonFloat.asJSON( 3 ), expectedJsonPrec3 );
// as GML2
- QString expectedGML2( QStringLiteral( "0,0 0,10 10,10 10,0 0,0" ) );
- expectedGML2 += QStringLiteral( "1,1 1,9 9,9 9,1 1,1" );
+ QString expectedGML2( QStringLiteral( "0,0 0,10 10,10 10,0 0,0" ) );
+ expectedGML2 += QStringLiteral( "1,1 1,9 9,9 9,1 1,1" );
QCOMPARE( elemToString( exportPolygon.asGML2( doc ) ), expectedGML2 );
- QString expectedGML2prec3( QStringLiteral( "1.111,1.111 1.111,11.111 11.111,11.111 11.111,1.111 1.111,1.111" ) );
- expectedGML2prec3 += QStringLiteral( "0.667,0.667 0.667,1.333 1.333,1.333 1.333,0.667 0.667,0.667" );
+ QString expectedGML2prec3( QStringLiteral( "1.111,1.111 1.111,11.111 11.111,11.111 11.111,1.111 1.111,1.111" ) );
+ expectedGML2prec3 += QStringLiteral( "0.667,0.667 0.667,1.333 1.333,1.333 1.333,0.667 0.667,0.667" );
QCOMPARE( elemToString( exportPolygonFloat.asGML2( doc, 3 ) ), expectedGML2prec3 );
//as GML3
diff --git a/tests/testdata/qgis_server/wfs_getfeature_limit2.txt b/tests/testdata/qgis_server/wfs_getfeature_limit2.txt
index 47912d6054e..5484b4d8a68 100644
--- a/tests/testdata/qgis_server/wfs_getfeature_limit2.txt
+++ b/tests/testdata/qgis_server/wfs_getfeature_limit2.txt
@@ -14,7 +14,7 @@ Content-Type: text/xml; charset=utf-8
- 8.20349634,44.90148253
+ 8.20349634,44.90148253
1
@@ -31,7 +31,7 @@ Content-Type: text/xml; charset=utf-8
- 8.20354699,44.90143568
+ 8.20354699,44.90143568
2
diff --git a/tests/testdata/qgis_server/wfs_getfeature_nobbox.txt b/tests/testdata/qgis_server/wfs_getfeature_nobbox.txt
index 931fed695f6..b34209be17c 100644
--- a/tests/testdata/qgis_server/wfs_getfeature_nobbox.txt
+++ b/tests/testdata/qgis_server/wfs_getfeature_nobbox.txt
@@ -14,7 +14,7 @@ Content-Type: text/xml; charset=utf-8
- 8.20349634,44.90148253
+ 8.20349634,44.90148253
1
@@ -31,7 +31,7 @@ Content-Type: text/xml; charset=utf-8
- 8.20354699,44.90143568
+ 8.20354699,44.90143568
2
@@ -48,7 +48,7 @@ Content-Type: text/xml; charset=utf-8
- 8.20345931,44.90139484
+ 8.20345931,44.90139484
3
diff --git a/tests/testdata/qgis_server/wfs_getfeature_start1_limit1.txt b/tests/testdata/qgis_server/wfs_getfeature_start1_limit1.txt
index 8ff38d7469d..2610da2012f 100644
--- a/tests/testdata/qgis_server/wfs_getfeature_start1_limit1.txt
+++ b/tests/testdata/qgis_server/wfs_getfeature_start1_limit1.txt
@@ -14,7 +14,7 @@ Content-Type: text/xml; charset=utf-8
- 8.20354699,44.90143568
+ 8.20354699,44.90143568
2
diff --git a/tests/testdata/qgis_server/wfs_getfeature_startindex2.txt b/tests/testdata/qgis_server/wfs_getfeature_startindex2.txt
index a0eccb4cfde..805a506c935 100644
--- a/tests/testdata/qgis_server/wfs_getfeature_startindex2.txt
+++ b/tests/testdata/qgis_server/wfs_getfeature_startindex2.txt
@@ -14,7 +14,7 @@ Content-Type: text/xml; charset=utf-8
- 8.20345931,44.90139484
+ 8.20345931,44.90139484
3