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

CZMLDataSource with custom ellipsoids #11185

Closed
malaretv opened this issue Mar 24, 2023 · 1 comment
Closed

CZMLDataSource with custom ellipsoids #11185

malaretv opened this issue Mar 24, 2023 · 1 comment

Comments

@malaretv
Copy link
Contributor

CZMLDataSource has a number of spots where Ellipsoid.WGS84 is assumed and it makes the datasource unusable for non-earth maps.

One example is here where Ellipsoid.WGS84 is explicitly called

function convertCartographicRadiansToCartesian(cartographicRadians) {
const length = cartographicRadians.length;
if (length === 3) {
scratchCartographic.longitude = cartographicRadians[0];
scratchCartographic.latitude = cartographicRadians[1];
scratchCartographic.height = cartographicRadians[2];
Ellipsoid.WGS84.cartographicToCartesian(
scratchCartographic,
scratchCartesian
);
return [scratchCartesian.x, scratchCartesian.y, scratchCartesian.z];
}

And also like here where the absence of an ellipsoid parameter to Cartesian3.fromDegreesArrayHeights() causes WGS84 to be assumed internally.

packetData.array = Cartesian3.fromDegreesArrayHeights(
packetData.cartographicDegrees
);

I am happy to provide a fix for this but was wondering what the team thinks is the best path to add this option?

I could add an ellipsoid to be passed in with the LoadOptions with each new CZMLDataSource() call. e.g.

let datasource = new CZMLDataSource(url, {ellipsoid: myCustomEllipsoid})

This seems nicest in terms of API but implementation-wise would mean passing the ellipsoid value through all the individual nested process*() calls.

The other option is the default ellipsoid could exist as a static property on CZMLDataSource. All internal places an ellipsoid is required would use this static property. The user code to then use a different ellipsoid could be something like this:

CZMLDataSource.DEFAULT_ELLIPSOID = myCustomEllipsoid;
let datasource = new CZMLDataSource(url)

Much simpler to implement but not great if multiple ellipsoid values are desired within an application -- I imagine that case is pretty rare?

thoughts?

@ggetz
Copy link
Contributor

ggetz commented Mar 28, 2023

Hi @malaretv, thanks for bringing up this issue! I think this has been discussed previously and the conclusion mentioned at the time to use a default ellipsoid. Since this is so similar, I'll close this issue now to keep the discussion in one place. If you have any further input on this, please post it there instead.

As a workaround in the meantime, it should be possible to modify WGS84 to be a custom ellipsoid.

Thanks!

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

No branches or pull requests

2 participants