Display GeoPoint via 'Cesium GeoJson Document Raster Overlay'

Hi,

In my project, we have a use case where we need to display a GeoJSON Feature collection that contains points, polylines, and polygons.

I saw that the ‘CesiumGeoJsonDocumentRasterOverlay’ supports both Lines and polygons, but not points.

Is it by design? Can someone make a PR to add a default style for displaying Geo Points, same as is done in Cesium JS ( Sandcastle | CesiumJS )?

Thanks!

@azrogers, @Kevin_Ring, @janine any thoughts or road map on this direction?
If a PR is done regarding this issue will it be accepted?

@asaf.masa Currently I’m working on other vector work, not related to the GeoJsonDocumentRasterOverlay but which uses some of the same systems. This work will require adding support for points so I’m expecting we’ll have the ability to show points on a raster overlay by next release! Whether the modifications for supporting points in Cesium for Unity make it into next release is less clear but it shouldn’t be too long after at least.

The main reason we didn’t implement points in our original raster overlay is that exactly what it means to display a point is unclear. CesiumJS can display points as circles like in the example you shared, but you can also add pins using the PinBuilder. Support for points in the next release will be displaying points as circles (with configuration for point radius, fill color, and outline color), but if there’s some other way you’re looking to display points let me know as that’d be useful information for future work!

@azrogers Thanks for the reply.
I have some use cases in my application

  1. I need to draw a Feature collection as lines, polygons, and points with a specific custom style for each type (a circle is good enough for some scenarios)

    1. Custom style per object that will override the “Collection style” - for example, all cubes are blue, but several will be shown as red
    2. Option - We will have the ability to attach prefabs to the component that will be drawn instead of points (clamped to ground, etc.)
  2. I need to place “sprites” instead of some of the points (via the style)

  3. I need to place a pin “indicator” as in the attached image (the “pin” can get 3D behavior, can be behind the structure, etc.)

  4. I need the ability to “select” the GeoJSON Feature by clicking on it to use its data in my app, access its properties, and to select it also from code (from a panel)

  5. I need the ability to “attach” a sprite and text to a polygon/polyline/point drawing (attached image example)

As you can see, I have a lot of requirements :sweat_smile: , and I really like to know what from the above is in your roadmap.

Or if we need to open a list of feature requests on the Cesium-Unity repo.

@azrogers Hi, do you have an update?

Hi @asaf.masa

Thanks for the detailed use cases! They inform us a lot.

Yes, it would be best as you suggest to open a list of feature requests. It gives our teams greater visibility and planning capabilities.

Thank you!

-Cory

Support for points has been merged into cesium-native as part of https://github.com/CesiumGS/cesium-native/pull/1365. For full support in Cesium for Unity, we need to update the vector style classes (here and here) so that point styling can be customized. I am hoping to take a look at implementing this soon!

It is worth mentioning that, though we do not have support for drawing points on the raster overlay, you should already be able to access the point data in the GeoJsonDocument directly and spawn any prefabs you need.

@azrogers Thanks!

"I need the ability to “select” the GeoJSON Feature by clicking on it to use its data in my app, access its properties, and also select it from code (from a panel)"

About the above, is it in the roadmap? or should I use a different approach? (If so, what do you recommend?)

@asaf.masa Support for picking elements from the overlay is something we’re also working on. But I think you can implement this yourself as well:

  • Perform a Physics.Raycast from the mouse position (using Camera.main.ScreenPointToRay(Input.mousePosition))
  • Use TransformUnityPositionToEarthCenteredEarthFixed on the georeference to transform the raycast’s hit.point into an ECEF coordinate.
  • Use the georeference’s ellipsoid to run that ECEF coordinate through CenteredFixedToLongitudeLatitudeHeight to get cartographic coordinates like those used in GeoJSON.
  • Look through the CesiumGeoJsonDocument to see if any features are close to this cartographic coordinate. Keep in mind that GeoJSON (and as such the CesiumGeoJson classes) store cartographic coordinates in degrees whereas the rest of Cesium stores them in radians. This just means multiplying by Mathf.Rad2Deg (or Mathf.Deg2Rad)

I would try to speed this up by perhaps traversing the GeoJSON document only once to build an array of all locations we will have to check on a mouse click, so that this operation is just zipping through a flat array instead of traversing through the tree.

Whatever solution we come up with for picking objects will probably be very similar to this rough description of an implementation.

@azrogers
I’m looking at adding GeoJSON point rendering to Cesium for Unity, and I’d like to
follow the same approach Cesium for Unreal already uses, for consistency across the
two engines.

From reading the cesium-unreal source, it looks like GeoJSON points are handled via
CesiumGeoJsonDocumentRasterOverlay (backed by cesium-native’s CesiumVectorData /
VectorRasterizer) i.e. features are rasterized into a texture that’s draped on the
tileset surface, depth-tested like the rest of the tileset, rather than drawn as
screen-facing billboard pins.

Can I implement points in cesium-unity the same way as a raster-overlay path that
mirrors Unreal’s GeoJsonDocumentRasterOverlay rather than introducing a separate
billboard/marker system?

A couple of specific questions:

  • Is the raster-overlay path the intended/canonical way to do GeoJSON points in
    cesium-unity, matching Unreal?
  • Is there any plan to support CesiumJS-style “above everything” billboard pins
    (disableDepthTestDistance) in either engine, or is the raster-overlay approach the
    agreed direction for both?

Want to make sure I build this the same way as Unreal before starting. Thanks!

@azrogers What do you think about @Baruch_Haivatov proposal?
I think it’s great. Do you approve?