Fix determination of geodesic line when first segment is small and coordinates are reprojected

This commit is contained in:
Nyall Dawson 2019-01-14 15:22:28 +10:00
parent 4e6a7309e1
commit 1248bea156
2 changed files with 6 additions and 2 deletions

View File

@ -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 )

View File

@ -791,6 +791,10 @@ class TestQgsDistanceArea(unittest.TestCase):
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()