Skip to content

Commit 2b12a15

Browse files
authoredFeb 10, 2017
Merge pull request #4129 from rldhont/server-geojson-precision
[Server] The RFC 7946 GeoJSON specification recommends limiting coordinate precision to 6
2 parents b964777 + 0e7d428 commit 2b12a15

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed
 

‎src/core/qgsjsonutils.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ class CORE_EXPORT QgsJSONExporter
4040

4141
/** Constructor for QgsJSONExporter.
4242
* @param vectorLayer associated vector layer (required for related attribute export)
43-
* @param precision maximum number of decimal places to use for geometry coordinates
43+
* @param precision maximum number of decimal places to use for geometry coordinates,
44+
* the RFC 7946 GeoJSON specification recommends limiting coordinate precision to 6
4445
*/
45-
QgsJSONExporter( const QgsVectorLayer* vectorLayer = nullptr, int precision = 17 );
46+
QgsJSONExporter( const QgsVectorLayer* vectorLayer = nullptr, int precision = 6 );
4647

4748
/** Sets the maximum number of decimal places to use in geometry coordinates.
49+
* The RFC 7946 GeoJSON specification recommends limiting coordinate precision to 6
4850
* @param precision number of decimal places
4951
* @see precision()
5052
*/

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,10 @@ namespace QgsWfs
10881088

10891089
QgsJSONExporter exporter;
10901090
exporter.setSourceCrs( crs );
1091-
exporter.setPrecision( prec );
1091+
//QgsJSONExporter force transform geometry to ESPG:4326
1092+
//and the RFC 7946 GeoJSON specification recommends limiting coordinate precision to 6
1093+
Q_UNUSED( prec );
1094+
//exporter.setPrecision( prec );
10921095

10931096
//copy feature so we can modify its geometry as required
10941097
QgsFeature f( *feat );

0 commit comments

Comments
 (0)
Please sign in to comment.