Geojson & Unreal

Hello folks

I’m new with Cesium. I am working on an unreal project, where we use cesium to display our city mesh and so far i really like the tool.

We are in a situation where i have the feeling that we are re-inventing the wheel and i’m exploring options to get the most out of cesium.

Basically, we want to use like custom json files to define objects to be spawn in space like custom aerial zone, waypoints, stuff like that. so right now, we made a custom actor that spawn shapes in our scene (using cesium georeferences to convert lat/lng to scene coordinates), and it’s working

As I was looking into better solutions, I kind of convinced mysef that :

  1. we should use 3d geojson format to define our stuff properly instead of custom json objects
  2. there must be a solution to pass our custom objects to cesium-ion api directly and let cesium do the heavy job instead of creating custom stuff on our Unreal side.

What i found so far:

  1. it’s possible to feed cesium-ion with a geojson file directly. However, while it would be working in a cesiumJS client, cesium-unreal doesn’t want to retrieve that object in unreal, claiming geojson is not supported.
  2. I am able to feed cesium-ion with a fbx and visualize it in unreal. (I would have love to be able to do that with a json)
  3. From what i understand, I need to find a workaround to first convert my geojson to a 3d object , and then i would theorically able to convert that into a “3d tile” with cesium-ion, that cesium-unreal will accept to display

I wish there were a direct solution like with cesiumJS, as it is exactly what i want:

Does anyone have a working solution for this late 2024 years ? Or should I dive into this pipeline idea of converting geojson files to meshes, then host this mesh with cesium-ion, then retrieve it in unreal as a 3d tile ? (But at the end, this sound as painful as our initial solution :confused: )

Love to hear your thoughts and ideas
Thanks everyone

Hi @Thibault_Potier, welcome to the community!

GeoJSONs are unfortunately not supported in Cesium for Unreal (yet), so your solution is probably the best way to go for now. It looks great from what you shared! :smile:

We have had a Github issue open for GeoJSON support linked below. Vector rendering is not a trivial problem, hence why we still haven’t developed a solution. But I’ll add a link to this post so that we can keep track of community input.

In the meantime, let us know if we can support you with anything else within the plugin!

1 Like

Hi everyone,
Just a quick update: I’m working on developing this custom feature myself.

Essentially, I’m building a pipeline that takes a GeoJSON file and processes it through Blender → Cesium API → Unreal Engine client. There’s still a lot of work to do, but I believe this could be a valid interim solution while waiting for official support from smarter folks. :smile:

I’ll keep exploring this approach

Currently, with a few custom Python scripts, I can:

  1. Take a GeoJSON file as input.
  2. Generate an FBX.
  3. Host it as 3D Tiles on Cesium Ion.
  4. Retrieve and display it on the Unreal Engine side.

Right now, I support Point, Polygon, and LineString geometries. I’m looking to expand that compatibility and also need to focus on ensuring that the final objects are accurately positioned in the world. So far, I haven’t prioritized this, but it’s definitely something I’ll be working on to make sure everything aligns as expected.

Looking forward to any feedback or interest!

Example: a geojson interpreted natively in cesiumjs:

my custom pipeline:
Blender ouput example :


cesium hosting example :

unreal result example :

Work in progress !

1 Like

That looks really cool @Thibault_Potier, thanks for sharing!

1 Like

Bump here

I had a bit more time to spent on this.
Things looks great : I can draw things with geojson.io (for example), run my scripts, than create some 3d tileset in unreal to retrieve it


I would like to automate the unreal side, but can’t figure out a way to retrieve my asset list from cesium ion to print my assets id ingame with unreal (the first step before adding a tileset with those refs)

I can do a python code that retrieve that list successfully, but I struggle a lot everytime i need to do something inside unreal :upside_down_face:

Does someone have a sample example of an Unreal Actor that communicates with cesium ion api in game ?

My final purpose is to have an actor in my scene that can get my asset list in order to add new cesium3dtleset with proper asset id at runtime. (right now, i do that by hand)

Also, I Iooked for a callback in cesium ion api to be notified when new asset are added to my assets but couldn’t find one. Is there a good way to do it ? (instead of retrieving periodically my asset list to decide if new objects must be spawn unreal side)

Small precision:
I want to do exactly that, but in-game, and automatically

Hi @Thibault_Potier, at the moment much of this functionality is implemented in the CesiumEditor module. This means it can’t currently be used directly from Unreal outside of the editor. But you can look over the code to see how you might interact with the Cesium ion API from Unreal.

We don’t currently have an endpoint for Cesium ion to communicate to the client that a new asset has been uploaded, so polling the asset list is probably your best bet (please do this on a timer, such as every 30 seconds, rather than requesting the asset list constantly!). You might be interested in CesiumIonClient::Connection, the class we use across Cesium Native and Cesium for Unreal for interacting with the ion REST API. Particularly, you might use it from Unreal like:

CesiumIonClient::Connection ionConnection(
	getAsyncSystem(), 
	getAssetAccessor(), 
	"your access token here",
	CesiumIonClient::ApplicationData { AuthenticationMode::CesiumIon, "", "" }
);

// later
ionConnection.assets().thenInMainThread([](Response<Assets>&& response) {
	if(response.value) {
		// do something with response.value
	}
});

I haven’t tested this, but it should work. If you’re requesting the assets list over and over again to check for new assets, you’ll want to add some sort of flag that keeps track of when an asset list request is pending, as the method works asynchronously and thenInMainThread’s callback will only be called when the request completes, which depending on network conditions could be a relatively long time, and you don’t want to make another request while still waiting for the first one to return.

As for replicating the behavior of the “Add to Level” button, here’s what that button is actually doing:

ACesium3DTileset*
FCesiumEditorModule::CreateTileset(const std::string& name, int64_t assetID) {
  AActor* pNewActor = SpawnActorWithClass(ACesium3DTileset::StaticClass());
  ACesium3DTileset* pTilesetActor = Cast<ACesium3DTileset>(pNewActor);
  if (pTilesetActor) {
    pTilesetActor->SetActorLabel(UTF8_TO_TCHAR(name.c_str()));
    if (assetID != -1) {
      pTilesetActor->SetIonAssetID(assetID);
    }
  }
  return pTilesetActor;
}

More or less, all you need to do is create a new ACesium3DTileset actor and set the ion Asset ID to the ID you want to load.

1 Like