Open Zekiye-VAP opened 1 year ago
Not directly addressing your misalignment issue, however, I've just updated all the cesium loaders, and updated the ?add_cesium()
example with the (now) correct URL. The buildings and the pointcloud now work for me. Do you get the same results?
ion_asset <- 96188
tile_data <- paste0("https://assets.ion.cesium.com/",ion_asset,"/tileset.json")
mapdeck(
style = mapdeck_style("dark")
, location = c(144.95, -37.82)
, zoom = 14
, pitch = 60
) %>%
add_cesium(
data = tile_data
, ion_token = ion_token
)
ion_asset <- 43978
tile_data <- paste0("https://assets.ion.cesium.com/",ion_asset,"/tileset.json")
mapdeck(
style = mapdeck_style("dark")
, location = c(144.95, -37.82)
, zoom = 14
, pitch = 60
) %>%
add_cesium(
data = tile_data
, ion_token = ion_token
)
The point cloud now works! The building layer is still not great. Here's a video showing the issues. You can see some buildings are under the base map and all the others are floating above it at varying heights across the map. https://github.com/SymbolixAU/mapdeck/assets/102117785/1f1e8c60-f318-4559-b65d-5b581c32c9f8
The cesium layer doesn't seem to work with all the assets either, I am trying to get 3D terrain into my map (Asset ID - 1). It is in my assets list on my cesium account but doesn't show up when I try to load it. Do you have any suggestions on bringing in 3D terrain?
Thank you for your quick responses!
full disclosure: I've never used this layer other than to build the examples as a 'proof-of-concept', so my knowledge is very limited.
Under the hood add_cesium()
is using deck.Tile3DLayer
, which in turn can only show PointClouds, Scenegraphs or SimpleMeshs. But it uses the CesiumLoader
to load the data. Hence the add_cesium()
function name.
{mapdeck} is designed to implement all the deck.gl examples. I can't see any native deck.gl examples that use scene.setTerrain()
, so this is one reason why it doesn't work
In the Cesium ion page, the code it gives for showing the pointcloud is scene.primitives.add()
:
const tileset = viewer.scene.primitives.add(
await Cesium.Cesium3DTileset.fromIonAssetId(43978)
);
and for the terrain it's scene.setTerrain()
viewer.scene.setTerrain(
Cesium.CesiumTerrainProvider.fromIonAssetId(1)
);
And they are both using different "loaders" (Cesium3DTileset.fromIonAssetId()
and CesiumTerrainProvider.fromIonAssetId()
).
Which explains why add_cesium()
doesn't work; it's only using the Cesium3DTileset
loader for the Tile3DLayer
.
Given there are Losts of different types of loaders, updating this add_cesium()
to account for them all could be tricky.
I'm not sure. In all the various terrain discussions I've seen there's no mention / examples of using the scene.setTerrain( CesiumTerrainProvider() )
methods. If you can find an example of someone getting this working with deckgl it should be possible to add it to mapdeck, even if it means writing custom javascript.
But for now I'm not sure I can help much (with the usual excuse of "work-gets-in-the-way-of-opensource-projects")
@Zekiye-VAP this may be relevant for you - https://github.com/r-spatial/discuss/issues/29#issuecomment-1694709846
Will keep looking into fixing the projections of the buildings for the cesium layer. I have switched over to using the add_terrain function for 3D terrain which is looking great however I am having issues with clear_terrain() and it seems like there is not a clear_cesium() function implemented yet. Is it possible to get these working? Thank you for all your help!!
Deck.gl has recently added a terrain extension to allow 2D layers to generate across the 3D surface. Would is this something that could be integrated into mapdeck? https://deck.gl/docs/api-reference/extensions/terrain-extension
Been trying to get the add_cesium function to work but have come across a few obstacles.
First, I was not able to get the example running and figured out an alternate method of calling the tile data using the tileset.json URL from this api call; https://api.cesium.com/v1/assets/{ion_asset}/endpoint (however this only seems to work for the Cesium OSM Buildings tileset).
I am trying to add the Cesium Open Street Map Buildings layer to my map and using the below chunk, I managed to get the buildings rendered HOWEVER it seems the projections do not match and many buildings are misaligned. Seems cesium only supports web mercator and WGS84, not EPSG:4326 which mapdeck renders in. (https://github.com/CesiumGS/cesium/issues/3877) Wondering if you encountered this issue with the original example?
Not really sure what to do to get this layer working and would appreciate any solutions.