Skip to content

Commit

Permalink
Fix determination of geodesic line when first segment is small and co…
Browse files Browse the repository at this point in the history
…ordinates are reprojected
  • Loading branch information
nyalldawson committed Jan 16, 2019
1 parent 4e6a730 commit 1248bea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsdistancearea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,8 @@ QVector< QVector<QgsPointXY> > QgsDistanceArea::geodesicLine( const QgsPointXY &
QVector< QgsPointXY > currentPart;
currentPart << p1;
double d = interval;
double prevLon = p1.x();
double prevLat = p1.y();
double prevLon = pp1.x();
double prevLat = pp1.y();
bool lastRun = false;
double t = 0;
while ( true )
Expand Down
4 changes: 4 additions & 0 deletions tests/src/python/test_qgsdistancearea.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,10 @@ def testGeodesicLine(self):
1000000, True))
self.assertEqual(g.asWkt(0),
'MultiLineString ((-13536427 14138932, -16514348 11691516, -17948849 9406595, -18744235 7552985, -19255354 6014890, -19622372 4688888, -19909239 3505045, -20037508 2933522),(20037508 2933522, 19925702 2415579, 19712755 1385803, 19513769 388441, 19318507 -600065, 19117459 -1602293, 18899973 -2642347, 18651869 -3748726, 18351356 -4958346, 17960498 -6322823, 17404561 -7918366, 16514601 -9855937, 14851845 -12232940, 13760912 -13248201))')
g = QgsGeometry.fromMultiPolylineXY(da.geodesicLine(QgsPointXY(18933544, -5448034), QgsPointXY(-11638480, 3962206),
1000000, True))
self.assertEqual(g.asWkt(0),
'MultiLineString ((18933544 -5448034, 20037508 -4772933),(-20037508 -4772933, -20002064 -4748323, -19015781 -3988451, -18153035 -3204936, -17383137 -2416816, -16678635 -1632067, -16015884 -852355, -15374147 -76043, -14734258 699941, -14077193 1478790, -13382634 2262546, -12627598 3050380, -11785404 3835868, -11638480 3962206))')

def testSplitGeometryAtAntimeridian(self):
da = QgsDistanceArea()
Expand Down

0 comments on commit 1248bea

Please sign in to comment.