Skip to content

Add support for loading and interacting with GeoJSON data in Blueprint #1651

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

Merged
merged 28 commits into from
Jul 1, 2025

Conversation

azrogers
Copy link
Contributor

@azrogers azrogers commented Apr 9, 2025

The companion to CesiumGS/cesium-native#1154. This PR adds blueprint functions for loading and interacting with GeoJSON data. In particular, it provides the ability to load GeoJSON from a string or from Cesium ion, the ability to query nodes, and the ability to obtain primitives as values usable in Unreal.

One note is that access to the properties of a vector node requires blueprint functionality for interacting with JSON objects. I elected to push this responsibility onto the JSON Blueprint Utilities plugin, which is an official Unreal plugin but not enabled by default. Returning the FJsonObjectWrapper struct from a method is supported without this plugin enabled, but users will have to enable that plugin if they want to be able to do anything with it.

Copy link
Member

@kring kring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @azrogers! Lots of small comments below, but this looks really good!

return {};
}

return (ECesiumGeoJsonObjectType)InObject._pObject->getType();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this conversion via cast, it would add a bit of safety to add static assertions that the enum values are equivalent. That way a change on either side (other than adding a new enum value at the end) would be flagged as a compiler error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean. How would we assert that the enums are the same?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. I've added it here.

Copy link
Contributor

@j9liu j9liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to jump on right after @kring 's review -- apparently I had started a review a while ago, but didn't see that I forgot to submit the comments until now when I was looking through Kevin's 🤦 I removed some duplicate feedback, so most of these are just doc / style fixes at this point

Comment on lines +5 to +7
#include "CesiumUtility/IntrusivePointer.h"
#include "CesiumVectorData/GeoJsonDocument.h"
#include "CesiumVectorData/GeoJsonObject.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

angle brackets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we've decided on what we're doing about this in Unreal. The Cesium Native style is de facto to use angle brackets (though we've yet to write it down anywhere), but our Unreal code uses quotes a lot more than angle brackets, and all the code from Epic uses quotes instead of angle brackets.

#include "CesiumGeoJsonDocument.h"
#include "CesiumRuntime.h"

#include "CesiumUtility/Result.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include "CesiumUtility/Result.h"
#include <CesiumUtility/Result.h>

@@ -0,0 +1,412 @@
#include "CesiumGeoJsonObject.h"

#include "CesiumGeospatial/Cartographic.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include "CesiumGeospatial/Cartographic.h"
#include <CesiumGeospatial/Cartographic.h>

Comment on lines +6 to +7
#include "CesiumUtility/IntrusivePointer.h"
#include "CesiumVectorData/GeoJsonDocument.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include "CesiumUtility/IntrusivePointer.h"
#include "CesiumVectorData/GeoJsonDocument.h"
#include <CesiumUtility/IntrusivePointer.h>
#include <CesiumVectorData/GeoJsonDocument.h>

@j9liu j9liu added this to the July 2025 Release milestone Jun 12, 2025
@azrogers
Copy link
Contributor Author

@kring @j9liu I think that's all the review comments taken care of, minus the #include question (are we committing to angle bracket includes in Unreal)?

@kring
Copy link
Member

kring commented Jun 27, 2025

Looks like we still have some VectorDocuments:
image

@kring
Copy link
Member

kring commented Jun 27, 2025

There's a lot of "vector document" in a bunch of other places as well, including filenames and parameter names (which matter because they're shown as output in names in Blueprint). Can I bug you to do a pass over the code to replace all those occurrences, and then I'll look for any that might have been missed while I'm reviewing?

@azrogers
Copy link
Contributor Author

@kring I believe I've caught all of them, let me know if you find any others.

@kring
Copy link
Member

kring commented Jul 1, 2025

Thanks @azrogers!

@kring kring merged commit bae08cb into main Jul 1, 2025
18 checks passed
@kring kring deleted the geojson-support branch July 1, 2025 15:17
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

Successfully merging this pull request may close these issues.

3 participants