Skip to content

geoJSON tilesets with glTF translation#1334

Open
timoore wants to merge 38 commits intomainfrom
tileset-geojson2
Open

geoJSON tilesets with glTF translation#1334
timoore wants to merge 38 commits intomainfrom
tileset-geojson2

Conversation

@timoore
Copy link
Copy Markdown
Contributor

@timoore timoore commented Mar 27, 2026

Very early work

@timoore timoore requested a review from azrogers April 17, 2026 10:56
@timoore timoore marked this pull request as ready for review April 17, 2026 10:56
@j9liu j9liu requested review from j9liu and lilleyse and removed request for azrogers April 17, 2026 13:59
Copy link
Copy Markdown
Contributor

@lilleyse lilleyse left a comment

Choose a reason for hiding this comment

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

Thanks @timoore! A few comments from me, the only major one being about polyline batching.

Also, when you have a chance could you test this out in Unreal, Unity, and Godot?

Comment on lines +58 to +63

/**
* @brief Whether to translate vector feature data, e.g. GeoJSON content, to
* glTF, or leave it in its native format.
*/
bool translateVectorFeatures = true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe this option can be removed now?

@@ -1155,15 +1212,16 @@ TilesetJsonLoader::loadTileContent(const TileLoadInput& loadInput) {
} else {
// not a renderable content, then it must be external tileset
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe update this comment to something like:

Suggested change
// not a renderable content, then it must be external tileset
// Otherwise must be JSON content, either an external tileset or GeoJSON

ExternalContentInitializer&& externalContentInitializer,
const CesiumGeospatial::Ellipsoid& ellipsoid) {
const CesiumGeospatial::Ellipsoid& ellipsoid,
rapidjson::Document& tilesetJson) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since tilesetJson is later moved I think rvalue reference would make more sense here.

Suggested change
rapidjson::Document& tilesetJson) {
rapidjson::Document&& tilesetJson) {

const CesiumGeospatial::Ellipsoid& ellipsoid) {
const CesiumGeospatial::Ellipsoid& ellipsoid,
rapidjson::Document& tilesetJson) {
// create external tileset
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment can be removed now that the parsing code has moved elsewhere

const CesiumAsync::IAssetResponse* pResponse = pCompletedRequest->response();
const auto& responseData = pResponse->data();

rapidjson::Document tilesetJson;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Calling this variable tilesetJson might be misleading. Maybe simply json?

Comment on lines +278 to +286
using Point = std::array<double, 2>;
std::vector<std::vector<Point>> polygon;

for (const auto& ring : polygonIn) {
polygon.emplace_back();
for (const auto& coord : ring) {
polygon.back().push_back(Point{{coord[0], coord[1]}});
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For performance, some of these vectors could be reserved in advance

Comment on lines +489 to +495
pbr.roughnessFactor = 1.0;
pbr.baseColorFactor[0] = 0.0;
pbr.baseColorFactor[1] = 0.0;
pbr.baseColorFactor[2] = 0.0;
material.doubleSided = true;
// International orange
material.emissiveFactor = {0xff / 255.0, 0x4f / 255.0, 0.0};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does setting the emissive have any impact on lighting in Unreal?

pbr.roughnessFactor = 1.0;
pbr.baseColorFactor[0] = 0.0;
pbr.baseColorFactor[1] = 0.0;
pbr.baseColorFactor[2] = 0.0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also add pbr.baseColorFactor[3] = 1.0;?

Copy link
Copy Markdown
Contributor

@lilleyse lilleyse Apr 17, 2026

Choose a reason for hiding this comment

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

Never mind, 1.0 is the default for all channels. Still, might not hurt to be explicit.

return bufferViewIndex;
}

int32_t GltfConverterImpl::makeAccessor(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These helper functions (makeBufferView, makeAccessor) could possibly be removed. Some areas call the helper functions but other areas just create the objects inline (which I think is clean enough).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My intent is to use the helper functions throughout. The repetitive verbosity was driving me crazy .

Comment on lines +301 to +304
// GeoJson polygons contain an outer counter and possible inner contours. The
// first and last coordinates must be identical. An optimization would be to
// only include that coordinate once, but for now we will put both values into
// the big array of coordinates.
Copy link
Copy Markdown
Contributor

@lilleyse lilleyse Apr 17, 2026

Choose a reason for hiding this comment

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

The implementation looks ok, but it would be good to get visual confirmation that holes are working. I found an example here: https://mapsam.com/geojson-ring-visual/

@lilleyse
Copy link
Copy Markdown
Contributor

Oh and a meta comment, @timoore could you update the PR description now that the PR is further along?

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.

4 participants