Skip to content

Rasterize Point and MultiPoint in GeoJsonDocumentRasterOverlay#1400

Merged
j9liu merged 6 commits into
CesiumGS:mainfrom
baruchInsert-tech:geojson-document-overlay-points
Jul 9, 2026
Merged

Rasterize Point and MultiPoint in GeoJsonDocumentRasterOverlay#1400
j9liu merged 6 commits into
CesiumGS:mainfrom
baruchInsert-tech:geojson-document-overlay-points

Conversation

@baruchInsert-tech

@baruchInsert-tech baruchInsert-tech commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

CesiumVectorOverlays::GeoJsonDocumentRasterOverlay did not actually rasterize Point and MultiPoint geometry, even though the changelog for v0.61.0 states that it can display points. This PR makes the document overlay genuinely render points, fixing that latent gap.

The problem

The rasterizer already knows how to draw points: VectorRasterizer::drawGeoJsonObject routes GeoJsonPoint/GeoJsonMultiPoint to drawPoints(..., style.point). The geometry just never got there.

When GeoJsonDocumentRasterOverlay builds its quadtree, addPrimitivesToData runs RectangleAndLineWidthFromObjectVisitor to compute a bounding rectangle for each object and only stores objects that produce one (if (rect)). The visitor's operator() for GeoJsonPoint and GeoJsonMultiPoint were empty, so points yielded no rectangle and were dropped before ever reaching the rasterizer.

The fix

  • Implement the GeoJsonPoint / GeoJsonMultiPoint visitor operators so they build a (degenerate) bounding rectangle at each coordinate and bump maxLineWidthPixels by the point's pixel footprint (2 * radius, plus the outline width when outlined), mirroring the existing line-width padding.
  • Add a Point/MultiPoint branch to QuadtreeGeometryData::calculateBoundingRectangleForTileSize so per-tile bounds are padded by that same pixel footprint (otherwise points fell into the line branch and were sized by style.line).
  • Update the now-stale comment in addPrimitivesToData that claimed points are intentionally not rasterized.

Points then flow through the existing machinery and are rasterized as filled/outlined circles using VectorStyle::point. No new drawing code was needed.

Tests

Added three render tests to TestGeoJsonDocumentRasterOverlay.cpp, each rasterizing an in-code document and asserting the expected colors appear:

  • Point rendered as a filled circle (fill color present).
  • Point with an outline (both fill and outline colors present).
  • MultiPoint (fill color present).

All three pass locally (RelWithDebInfo), and CesiumVectorOverlays + cesium-native-tests build clean.

Changelog

Added a Fixes entry under the unreleased section. Note the v0.61.0 entry already (incorrectly) claimed the document overlay could display points; this PR makes that true.

issue #1403

@azrogers
@j9liu

@baruchInsert-tech baruchInsert-tech force-pushed the geojson-document-overlay-points branch from 270d0bb to c884b03 Compare June 22, 2026 11:29
Point and MultiPoint geometry was silently dropped by the quadtree
build: the bounding-box visitor returned no rectangle for them, so they
never reached the rasterizer (which already knows how to draw them via
VectorRasterizer::drawGeoJsonObject -> drawPoints).

Make the Point/MultiPoint visitor operators produce a degenerate
bounding rectangle at each coordinate and pad the tile's pixel footprint
by the point's diameter (plus outline width), mirroring the existing
line-width padding. Points then flow through the existing machinery and
are rasterized as filled/outlined circles using VectorStyle::point.

Adds render tests for Point, outlined Point, and MultiPoint, and a
CHANGES.md entry.
@j9liu

j9liu commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Hi @baruchInsert-tech, sorry for the delay in getting around to this!

Can you merge in main here, and also fix the location of the changelog entry? We'll give this a review once that's done.

@baruchInsert-tech baruchInsert-tech force-pushed the geojson-document-overlay-points branch from 012a0b0 to 8056aa2 Compare July 7, 2026 11:20
@baruchInsert-tech

Copy link
Copy Markdown
Contributor Author

Hi @baruchInsert-tech, sorry for the delay in getting around to this!

Can you merge in main here, and also fix the location of the changelog entry? We'll give this a review once that's done.

Done! Thank U!

@j9liu j9liu left a comment

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.

Thanks for the PR @baruchInsert-tech! I can confirm that points now render as a result of this PR, though there is a slight issue with outline rendering (see the comments).

Let me know when these comments are addressed -- and please push the commits regularly, without --force, so that the diff is more obvious upon review. Thank you!

Comment thread CesiumVectorOverlays/test/TestGeoJsonDocumentRasterOverlay.cpp Outdated
Comment thread CesiumVectorOverlays/src/GeoJsonDocumentRasterOverlay.cpp Outdated
Comment on lines +108 to +115
// A point's pixel footprint is its radius (plus its outline width) in
// every direction. Encode that as an equivalent line width (the full
// diameter) so the shared pixel padding math below applies to it too.
activeLineStyle.width = 2.0 * this->pStyle->point.radius;
if (this->pStyle->point.outline) {
activeLineStyle.width += this->pStyle->point.outline->width;
}
activeLineStyle.widthMode = LineWidthMode::Pixels;

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.

Is it correct to hardcode this as Pixels?

I noticed that if you set Width Mode to meters, and the meters is greater than the point radius, then the points appear like this:

Image

This doesn't seem correct, though I can't tell from a glance which line of code is the culprit.

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.

Fixed

@j9liu j9liu Jul 8, 2026

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 appreciate the new unit test / changes for this, but this sadly wasn't fixed...

However, I did test whether point outlines work for VectorTilesRasterOverlay, and it appears to be a problem there too. This does point to a more underlying mistake that can be out of scope for this PR. At the same time, we'd really like for a human to verify the results of any PR changes before we get to it, to avoid this back-and-forth!

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.

Thanks!
Given you flagged it as reasonably out of scope, I've narrowed this PR back to the verified change , Point/MultiPoint now rasterize and reverted the bounds-padding attempt, which only affected tile coverage and never touched the actual rendering. I opened a separate issue for the shared meters-mode point-outline bug in VectorRasterizer.
#1413

And point taken on verifying renders before pushing, that's on me; I'll eyeball the output next time rather than round-tripping through review.

baruchInsert-tech and others added 3 commits July 8, 2026 10:36
Wrap the west/east lines to satisfy the column limit, matching the
adjacent south/north lines. Resolves the Quick Checks formatting
failure on PR CesiumGS#1400.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@j9liu j9liu left a comment

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.

Looks good, thanks @baruchInsert-tech !

@j9liu j9liu merged commit 76b1fa0 into CesiumGS:main Jul 9, 2026
14 checks passed
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.

GeoJsonDocumentRasterOverlay does not rasterize Point / MultiPoint geometry

3 participants