Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rectangle.fromDegrees Switches East and West When Crossing International Date Line #9895

Open
erikblessman opened this issue Oct 26, 2021 · 0 comments

Comments

@erikblessman
Copy link

When given coordinates for a rectangle that crosses the International Date Line (IDL), Rectangle.fromDegrees switches East and West. (Related to 7909, but not fixed by it).

Example:
`var viewer = new Cesium.Viewer('cesiumContainer', {sceneMode: Cesium.SceneMode.SCENE2D});

var west = -160, east = 160, north = 20, south = -20;
var pts = [[west,north], [east,north], [east,south], [west,south]];
var rectFromArray = Cesium.Rectangle.fromCartesianArray(Cesium.Cartesian3.fromDegreesArray(pts.flat()));
var rectFromDegrees = Cesium.Rectangle.fromDegrees(west, south, east, north);

console.log('rectFromArray', rectFromArray);
console.log('rectFromDegrees', rectFromDegrees);

viewer.scene.camera.flyTo({destination: rectFromArray});
setTimeout(() => {
viewer.scene.camera.flyTo({destination: rectFromDegrees});
}, 5000);`

From the log, you will see that rectFromArray shows the western edge to be just west of the IDL and the eastern edge to be just east of the IDL, but rectFromDegrees shows the opposite.

From the calls to camera.flyTo, it begins by correctly flying to the small area bound by west, south, east & north, but using those same coordinates for rectFromDegrees, it flies to all of the map EXCEPT the area bound by west, south, east & north.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants