經過數小時的調查,我找到了解決方案。這看起來像一個技巧,但它工作正常。
的一切都在這裏首先是從arc.js documentation原始代碼:
var start = { x: currentPoint.longitude, y: currentPoint.latitude },
end = { x: nextPoint.longitude, y: nextPoint.latitude },
generator = new arc.GreatCircle(start, end),
arcLine = generator.Arc(1000 ,{offset:10});
的主要問題是arc.js不能計算相交International Date Line線座標。所以我決定在計算Great Circle之前將點移到一個tile中。
我必須找到經度偏差:
var dateLineOffset = 180 - currentPoint.longitude;
它也可能是nextPoint.longitude
。取決於左側的位置。
後,您可以使用arc.js生成座標:
var start = { x: -180, y: currentPoint.latitude },
end = { x: nextPoint.longitude + dateLineOffset, y: nextPoint.latitude },
generator = new arc.GreatCircle(start, end),
arcLine = generator.Arc(1000 ,{offset:10});
然後,你需要重複生成的座標和修復所抵消。在我的情況下,我用地圖。
var coordinatesWithOffset = arcLine.geometries[0].coords,
geodesicLineCoordinates = coordinatesWithOffset.map(function(coord) {
return ol.proj.fromLonLat([coord[0] - dateLineOffset, coord[1]]);
}),
geodesicLine = ol.geom.LineString(geodesicLineCoordinates);
就是這樣。 geodesicLine
將包含適當的座標。

OFF-TOPIC:爲什麼你的照片中的敵意? –
@JonatasWalker不再:) :) –
哈哈哈..好多了:-) –