Skip to content

Commit 0e7d428

Browse files
committed
[Server] The RFC 7946 GeoJSON specification recommends limiting coordinate precision to 6
1 parent 501a5f9 commit 0e7d428

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/core/qgsjsonutils.h

+4-2
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

+4-1
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)