mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Fix date line breaks with non geographic input CRS
This commit is contained in:
parent
654d7a4391
commit
e286c094d6
@ -560,6 +560,7 @@ QList< QList<QgsPointXY> > QgsDistanceArea::geodesicLine( const QgsPointXY &p1,
|
||||
currentPart << p1;
|
||||
double d = interval;
|
||||
double prevLon = p1.x();
|
||||
double prevLat = p1.y();
|
||||
bool lastRun = false;
|
||||
double t = 0;
|
||||
while ( true )
|
||||
@ -582,7 +583,7 @@ QList< QList<QgsPointXY> > QgsDistanceArea::geodesicLine( const QgsPointXY &p1,
|
||||
// when breaking the geodesic at the date line, we need to calculate the latitude
|
||||
// at which the geodesic intersects the date line, and add points to both line segments at this latitude
|
||||
// on the date line.
|
||||
double lat180 = latitudeGeodesicCrossesDateLine( currentPart.constLast(), QgsPointXY( lon, lat ) );
|
||||
double lat180 = latitudeGeodesicCrossesDateLine( QgsPointXY( prevLon, prevLat ), QgsPointXY( lon, lat ) );
|
||||
|
||||
try
|
||||
{
|
||||
@ -621,6 +622,7 @@ QList< QList<QgsPointXY> > QgsDistanceArea::geodesicLine( const QgsPointXY &p1,
|
||||
}
|
||||
|
||||
prevLon = lon;
|
||||
prevLat = lat;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -723,7 +723,7 @@ class TestQgsDistanceArea(unittest.TestCase):
|
||||
g = QgsGeometry.fromMultiPolylineXY(da.geodesicLine(QgsPointXY(-13536427, 14138932), QgsPointXY(13760912, -13248201),
|
||||
1000000, True))
|
||||
self.assertEqual(g.asWkt(0),
|
||||
'MultiLineString ((-13536427 14138932, -16514348 11691516, -17948849 9406595, -18744235 7552985, -19255354 6014890, -19622372 4688888, -19909239 3505045),(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))')
|
||||
'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))')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user