Polylines distorted across antimeridian

1. A concise explanation of the problem you're experiencing.

PolyLines across the antimeridian are getting distorted in 2D view. Does not matter if the polyline is from lon = -200 to -160 or lon = 160 to -160

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

4. The Cesium version you're using, your operating system and browser.

Cesium 1.36, Windows 10 64-bit, Chrome Version 60.0.3112.90 32-bit

Hi Jay,

I’m having trouble running your sandcastle demo because of some errors with your relative file paths. So I can’t see what the problem is exactly.

Does this look like the distortion you’re seeing?

It would help if you could get your sandcastle demo working out of the box, that way we can track down the bug more easily.

Thanks!

Gabby

My apologies Gabby, that sandbox is incomplete. I adapted it from my previous question but apparently I pasted the wrong link. Below is the correct one.

Thanks, I’m able to see it now!

I don’t believe this is a bug with polylines, I believe this distortion is due to the map projection, the Web Mercator projection, which distorts parts of the globe to get a nice flat map. Let me know if that doesn’t look the cause of the problem you’re having.

Thanks!

Gabby

I thought about that as well, but commenting out the WebMercatorProjection (line 16) only made the distortion less dramatic. Try it and see if you get the same result

Hi Jay,

So if I make a simple Sandcastle example with one polyline:

var viewer = new Cesium.Viewer(“cesiumContainer” );

viewer.entities.add({

polyline: {

    positions: Cesium.Cartesian3.fromDegreesArray([-120, 20, 120, 20])

}

});

You can see what’s going on if you toggle back and forth between the 2D and 3D scene modes. If you look at the globe in 3D, you can see that the line is connecting via a great arc (https://en.wikipedia.org/wiki/Great_circle) which connects two point via the shortest distance on the globe rather than keep latitude constant. When this gets projected in 2D, it appears “warped” because it’s not following a constant latitude. What you need is a Rhumb line(https://en.wikipedia.org/wiki/Rhumb_line) which I can’t find an option to use.

I’ve opened a feature request in GitHub here: https://github.com/AnalyticalGraphicsInc/cesium/issues/5795

Hope that helps,

Gabby

Actually, an issue already existed, see https://github.com/AnalyticalGraphicsInc/cesium/issues/4000

The lines I'm drawing are followSurface:false, which disables the great-arc behavior and directly connects two coordinates on the ellipsoid. I took your example and expanded it a bit with some more test cases and I think it's a better example of the behavior that confuses me. What you need to do after opening the Sandcastle is to switch to Columbus mode and then pan the camera down to 'look under the table' so to speak. You should see halves of some of the lines 'going into the table', which is the source of the distortion

When the line is from -80,20 to 80,20, it displays the distortion along the prime meridian, just as a line of any length across the antimeridian displays the behavior. However, if you have a line of -40,20 to 40,20, the behavior is as expected, and you get a flat line along the surface.

I believe what you are seeing is two points being connected by a straight line that goes through the earth. You can see what I’m talking about if you manipulate the scene such that you are looking along the line that has one point in CONUS, first by rotating up and then slightly horizontally.

Scott

I’ve also seen this issue and was meaning to post about it. By “this issue”, I mean that straight (i.e. followSurface:false) lines through the Earth show strangely in 2D and Columbus views. That is, in 2D mode the line looks like two sides of a triangle (/) connecting the sites, though sometimes the top is obscured. In Columbus view, you see the same /\ shape but it is intact and shown below the surface.

I think this is a different issue than the the “rhumb lines” enhancement. Could a separate issue be created for it?

Thanks,

Jacob

Hi Jacob,

I believe this exact situation you describe would be fixed by enabling rhumb lines. The line would would appear straight in both 2D and Columbus Views.

Thanks,

Gabby

Yes that's right Scott, what is strange to me is that some lines exhibit this behavior while others do not. For example, a 160 degree line from lon -170 to lon -10 will display properly in 2D and Columbus. However, a line from -80 to 80 will not.