Skip to content

Commit

Permalink
Enhance precision for wfs-t coordinates if srs is in degrees. Fixes bug
Browse files Browse the repository at this point in the history
#3358

git-svn-id: http://svn.osgeo.org/qgis/trunk@14961 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Dec 21, 2010
1 parent 88adba0 commit 9673931
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/providers/wfs/qgswfsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1967,6 +1967,14 @@ QDomElement QgsWFSProvider::createCoordinateElem( const QVector<QgsPoint> points
coordElem.setAttribute( "cs", "," );
coordElem.setAttribute( "ts", " " );

//precision 4 for meters / feet, precision 8 for degrees
int precision = 8;
if ( mSourceCRS.mapUnits() == QGis::Meters
|| mSourceCRS.mapUnits() == QGis::Feet )
{
precision = 4;
}

QString coordString;
QVector<QgsPoint>::const_iterator pointIt = points.constBegin();
for ( ; pointIt != points.constEnd(); ++pointIt )
Expand All @@ -1975,9 +1983,9 @@ QDomElement QgsWFSProvider::createCoordinateElem( const QVector<QgsPoint> points
{
coordString += " ";
}
coordString += QString::number( pointIt->x() );
coordString += QString::number( pointIt->x(), 'f', precision );
coordString += ",";
coordString += QString::number( pointIt->y() );
coordString += QString::number( pointIt->y(), 'f', precision );
}

QDomText coordText = doc.createTextNode( coordString );
Expand Down

0 comments on commit 9673931

Please sign in to comment.