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

Why Load geojson with Cesium3DTileset in 2d is not same as GeoJsonDataSource? #10777

Closed
libofei2004 opened this issue Sep 11, 2022 · 5 comments
Closed

Comments

@libofei2004
Copy link

libofei2004 commented Sep 11, 2022

I load a geojson with dataSources in 2d like this way:
viewer.dataSources.add(
Cesium.GeoJsonDataSource.load(
"../../Cesium-1.97/p1.json",
{
stroke: Cesium.Color.HOTPINK,
fill: Cesium.Color.PINK.withAlpha(0.5),
strokeWidth: 3
}
)
);
It seems like this:
image

Then I load the same geojson with Cesium3DTileset in 2d like this way:
const tileset = new Cesium.Cesium3DTileset({
url: "../../Cesium-1.97/tileset.json"
});
viewer.scene.primitives.add(tileset);
tileset.style = new Cesium.Cesium3DTileStyle({
color: "rgba(255, 0, 0, 0.8)"
});
the tileset.json content is:
{
"asset":{"version":"0.0","tilesetVersion":"1.0"},
"root":{
"boundingVolume":{
"region": [-3.14159,-1.57,3.14159,1.57,0,10000]
},
"geometricError":100000,
"content":{"uri":"p1.json"}
}
}
The geojson seems like this, it's bend.
image

In 3d mode, they looks the same,but in 2d mode,they are different, why?
How to make geojson with Cesium3DTileset looks the same as GeoJsonDataSource?

@libofei2004 libofei2004 changed the title Load geojson Why Load geojson with Cesium3DTileset in 2d is not same as GeoJsonDataSource? Sep 11, 2022
@ggetz
Copy link
Contributor

ggetz commented Sep 12, 2022

So the root of the difference in curvature is likely due to a difference in the arc type used in either case, which will determine how a 3D line is projected into 2D space. Though its odd that Cesium3dTileset and DataSource are not consistant. My guess is they both should be using Rhumb lines and result in a "straight line" in 2D.

@lilleyse Can you confirm?

@lilleyse
Copy link
Contributor

GeoJsonLoader (used by 3D Tiles) uses geodesic lines for performance reasons to avoid subsampling the geometry. Generally unless you have a tileset with the MAXAR_content_geojson extension you should be using GeoJsonDataSource which is a much more complete GeoJson implementation.

@libofei2004
Copy link
Author

@lilleyse I use a tileset for drawing geojson is indeed for good performance,drawing by tileset is much more efficient than GeoJsonDataSource.

@ggetz
Copy link
Contributor

ggetz commented Sep 13, 2022

Thanks @lilleyse! @libofei2004 I'm going to close the issue based on that answer. Let us know if there is still an issue.

@ggetz ggetz closed this as completed Sep 13, 2022
@libofei2004
Copy link
Author

Generally unless you have a tileset with the MAXAR_content_geojson extension you should be using GeoJsonDataSource which is a much more complete GeoJson implementation.

@ggetz @lilleyse I want to know how to have a tileset with the MAXAR_content_geojson extension?Does it make the geojson drawing a straight line?

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

3 participants