CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.94k stars 3.49k forks source link

Add option to use rhumb lines for geometry #4000

Closed mramato closed 5 years ago

mramato commented 8 years ago

Once #3998 gets merged, example.geojson.txt loads nicely in Cesium but exposes an existing bug we never noticed. Check out these two screenshots, one from geojson.io and one from Cesium:

geojson.io

image

Cesium

image

As you can see, Polygons (and other surface geometry) are currently connected with geodesics. While GeoJSON doesn't specify what the correct behavior is, most users seem to expect rhumb. We should add an option to all surface geometry to allow for either behavior and then hook up GeoJsonDataSource to use it.

mramato commented 8 years ago

The next version of the GeoJSON spec is in its final draft stages (and actually has been approved already I believe). I haven't read the whole thing yet, but it now explicitly defines hows to connect points to form geometry (and as suspected, Cesium is currently doing the wrong thing).

mramato commented 8 years ago

Maybe I missed a conversation somewhere, but it would be nice if this happened long before the mythical 2.0 release we want to do. We need to make sure we conform to the latest GeoJSON spec.

pjcozzi commented 8 years ago

I expect it will happen sooner since we likely need it for 3D Tiles. Not sure why this is labeled 2.0.

hpinkos commented 8 years ago

Sorry, I just labeled it 2.0 because we have a bunch of other geometry issues labeled 2.0

alberto-acevedo commented 7 years ago

+1

wallw-teal commented 7 years ago

While users may expect lat/lon boxes to be interpolated as rhumb lines, that is probably not true of other shapes. An option in the API would be nice, but the shortest distance between two points is always the geodesic. The 2D map library used by geojson.io is simply rendering a straight line in cartesian space between the 5 points in each box, which is taking advantage of the fact that a Mercator projection is being used (rhumb lines are straight lines in Mercator projections).

If an addition to the API is made, I would highly suggest taking a look at Karney's algorithms as implemented in GeographicLib. His algorithm for geodesics is faster than Vincenty's method and does not have the same issues with antipodal points. There is an ellipsoidal rhumb line algorithm as well.

Our application does its own GeoJSON parsing via another library and detects lat/lon rectangles. We then use Cesium.RectangleGeometry, which renders the rectangles as you expect.

ggetz commented 7 years ago

Came up on the forum again: https://groups.google.com/forum/#!topic/cesium-dev/_T3vRx1D858

mccoy1 commented 6 years ago

+1

zbennett10 commented 6 years ago

+1

hpinkos commented 5 years ago

Added in #7492

cesium-concierge commented 5 years ago

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/forum/#!topic/cesium-dev/_T3vRx1D858

If this issue affects any of these threads, please post a comment like the following:

The issue at https://github.com/AnalyticalGraphicsInc/cesium/issues/4000 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.