Hello All,
Is there a known issue that Cesium has in zooming to an extent that crosses the poles? I get in a WKT [1] which I translate into a Cartographic array [2]. That extent of that array [3] is then used to send the camera on a flight and finish there [4].
The issue is that when the camera flies it ends up at the wrong place (see image).
Any ideas?
Thanks
Toby
[1] POLYGON((173.432744991659 81.352294222274,177.322624535387 83.019958561176,183.74980554926 84.6283724821572,195.526528976403 86.1036634832159,219.067575925448 87.2249429886453,257.190466398135 87.4678448039113,287.747043392052 86.6363822051197,303.394411215325 85.2663339766817,311.551035037177 83.6997170373746,316.293929881442 82.0518501723837,319.304005087058 80.364270031322,321.335223859686 78.65456672004,322.764979449651 76.9312943391795,323.800422209977 75.1991053451193,324.563954520309 73.4606965030539,325.132234522747 71.7177694750058,325.55561974728 69.9713729699831,325.868474287099 68.2222165914708,326.095014008624 66.4708388210721,326.252784154321 64.7176064425749,326.354790223748 62.962789343714,326.410864006997 61.2066228093034,326.428569778813 59.4492272503271,326.413809593 57.6907033607286,326.371251199109 55.9311789072471,326.344136508253 55.1413103661434,326.312410022239 54.349082433211,344.102210841266 53.1200545386932,359.905612703499 49.5016896617048,388.011668730935 66.7671929523656,450.328564925755 69.5192676972965,472.283804747853 78.3223897366817,173.432744991659 81.352294222274))
[2] function WKT2CartographicArray(WKT) {
//mainly for image information.
var newWKT = WKT.replace(“frame:”, “”);
newWKT = newWKT.replace("((", “”);
newWKT = newWKT.replace("))", “”);
try {
newWKT = newWKT.replace(“POLYGON”, “”);
} catch (e) {
}
try {
newWKT = newWKT.replace(“POLYLINE”, “”);
} catch (e) {
}
try {
newWKT = newWKT.replace(“POINT”, “”);
} catch (e) {
}
var stringArray = (newWKT.split(","));
for (var i = 0; i < stringArray.length; i++) {
stringArray[i] = stringArray[i].replace(" ", “,”);
var subNumbers = stringArray[i].split(",");
for (var j = 0; j < subNumbers.length; j++) {
subNumbers[j] = parseFloat(subNumbers[j]);
}
stringArray[i] = Cesium.Cartographic.fromDegrees(subNumbers[0], subNumbers[1], 0);
}
return stringArray;
}
[3] var extent = new Cesium.Extent.fromCartographicArray(positionsArray);
[4] var flight = Cesium.CameraFlightPath.createAnimationExtent(scene.getFrameState(), {
destination: extent,
onComplete: function () { }
});