Cesium-unreal vector-overlay branch complie error

Hello, Cesium team!I encountered some issues when compiling cesium-unreal and would like to seek some advice. Previously, I saw on the Cesium forum that the vector-ovelay branch added the functionality to parse GeoJSON and XML files for RasterOverlay. I pulled down this branch and successfully compiled it with VS2022. Then, I added cesium-unreal to the Plugins directory of my project. However, when I started the project for compilation, the error shown in the picture occurred.

@Unreal_Miracle This is a common error when using mismatched compiler versions. Unreal only looks for certain versions of MSVC, which might not match the one that Visual Studio selects itself. Try adding the line

set(VCPKG_PLATFORM_TOOLSET_VERSION "14.38")

to cesium-unreal/extern/vcpkg-overlays/triplets/x64-windows-unreal.cmake and rebuilding Cesium for Unreal from scratch (removing all the previous build files) to force it to use the same version as Unreal.

1 Like

Thank you very much. I think that’s the problem.

I have successfully compiled the vector-overlay branch of cesium-unreal, and created a level. I also added the CesiumGeoJsonDocumentRasterOverlay component. How should I use this component?


I have successfully loaded the geojson file using the CesiumGeoJsonDocumentRasterOverlay component.Is there a way to set different colors for multiple polygons in the same geojson file?

I also encountered a problem before, as shown in the picture below.


I manually used vcpkg to install ktx. I’m not sure if there will be any impact.

@Unreal_Miracle We’ve just released Cesium for Unreal v2.18.0, which includes the GeoJSON raster overlay! This release might not be on Fab yet, but once it is, you might prefer grabbing it from there if you’re still having build issues :slight_smile:

As for your question of whether you can set different colors for polygons in the same file: there’s a couple of ways to go about this:

  1. If you don’t care what the colors are, you just want them to be different, you can set the “Color Mode” on CesiumGeoJsonDocumentRasterOverlay → Default Style → Polygon Style → Fill Style to “Random”. This will set each polygon’s fill color to a random value between (R: 0, G: 0, B: 0) and the color you specify. So if you specify red as the color (R: 255, G: 0, B: 0), the red value will be randomized between 0 and 255 and the other values will be untouched. If you specify white, all three channels will be randomized, and so on.
  2. If you want control over exactly what the styles are for each polygon (or any other object in the GeoJSON document, for that matter), you’ll want to set the styles of each object directly on the GeoJSON document itself. You can do this using Blueprint or C++. For Blueprint, it would look something like this:

    First, you need to obtain the document - we provide several “Load GeoJSON Document From ___” methods, but you can also use the “On Document Loaded” delegate on the raster overlay itself. Then you’ll want to find the objects you’re concerned with - there’s multiple ways to do this, but the easiest would be using an “Iterator Over Geo JSON Objects” node, which works like a Foreach loop. You can then check the “Current Object” in the Loop Body, and if it’s one of the objects you’re concerned with, you can call “Set Style” on the object to customize how it’s rendered. If you want to set the style depending on values in the properties of a GeoJSON Feature, the loop also provides a “Current Feature” output that returns the parent feature of the object, if any. Then, if you install the JSON Blueprint Utilities plugin (it comes with Unreal, just check the Plugins window in the editor), you can call “Get Properties” on this feature and use any values on it to decide how to style the object.
2 Likes

Thank you very much for your reply. It has been of great help to me.

1 Like

Hello, I tried loading a GeoJSON containing only polygon features from a URL and found that the color mode of the line style affects the color mode of the polygon style. Additionally, the random colors are not distinguished by feature boundaries but by tile boundaries.


1 Like

Thanks for reporting this @Cloud. I wrote an issue for the line style / polygon fill colorMode mixup here:

Keeping consistent feature colors across tiles will unfortunately be difficult, because the feature IDs need not be (and usually aren’t) consistent across tiles. Probably the way we’ll need to implement this is by generating a random color as a (deterministic) function of a user-specified property. I wrote an issue for that as well: