Skip to content

Commit c3f538e

Browse files
committedFeb 25, 2021
Update more expected test results
While these results are very different to the previous reference values, the geometries measured are extremely narrow polygons which range from ~-45 to ~45 degrees latitude, and accordingly large variations are expected depending on the area/length measurement formula used. Results have been checked against the R geosphere library and PostGIS geography type measurements, and match the measurements calculated using those packages (which are also based on GeographicLib calculations).
1 parent 686b199 commit c3f538e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed
 

‎tests/src/core/testqgsdistancearea.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,29 @@ void TestQgsDistanceArea::collections()
235235
QGSCOMPARENEAR( result, 0, 4 * std::numeric_limits<double>::epsilon() );
236236

237237
//collection of polygons
238+
239+
QgsGeometry poly1 = QgsGeometry::fromWkt( QStringLiteral( "Polygon((0 36.53, 5.76 -48.16, 0 25.54, 0 36.53))" ) );
240+
result = myDa.measureArea( poly1 );
241+
QGSCOMPARENEAR( result, 439881520607.079712, 1 );
242+
result = myDa.measureLength( poly1 );
243+
QGSCOMPARENEAR( result, 0, 4 * std::numeric_limits<double>::epsilon() );
244+
QgsGeometry poly2 = QgsGeometry::fromWkt( QStringLiteral( "Polygon((10 20, 15 20, 15 10, 10 20))" ) );
245+
result = myDa.measureArea( poly2 );
246+
QGSCOMPARENEAR( result, 290350317025.906982, 1 );
247+
result = myDa.measureLength( poly2 );
248+
QGSCOMPARENEAR( result, 0, 4 * std::numeric_limits<double>::epsilon() );
249+
238250
QgsGeometry polys( QgsGeometryFactory::geomFromWkt( QStringLiteral( "GeometryCollection( Polygon((0 36.53, 5.76 -48.16, 0 25.54, 0 36.53)), Polygon((10 20, 15 20, 15 10, 10 20)) )" ) ).release() );
239251
result = myDa.measureArea( polys );
240-
QGSCOMPARENEAR( result, 663136985074LL, 1 );
252+
QGSCOMPARENEAR( result, 730231837632.98669, 1 );
241253
result = myDa.measureLength( polys );
242254
QGSCOMPARENEAR( result, 0, 4 * std::numeric_limits<double>::epsilon() );
243255

244256
//mixed collection
245257
QgsGeometry mixed( QgsGeometryFactory::geomFromWkt( QStringLiteral( "GeometryCollection( LineString(0 36.53, 5.76 -48.16), LineString(0 25.54, 24.20 36.70), Polygon((0 36.53, 5.76 -48.16, 0 25.54, 0 36.53)), Polygon((10 20, 15 20, 15 10, 10 20)) )" ) ).release() );
246258
//measure area specifically
247259
result = myDa.measureArea( mixed );
248-
QGSCOMPARENEAR( result, 663136985075LL, 1 );
260+
QGSCOMPARENEAR( result, 730231837632.98669, 1 );
249261
//measure length
250262
result = myDa.measureLength( mixed );
251263
QGSCOMPARENEAR( result, 12006159, 1 );

0 commit comments

Comments
 (0)
Please sign in to comment.