I’m working on a project to generate 3D tiles from road data in Cesium. I have a shapefile containing road segments, and I want to display them as dashed lines rather than solid lines in the 3D tiles. The shapefile’s geometry type is multilinestring.
I’ve tried using WMS data to represent multilinestrings as dashed lines, but I’m facing two challenges:
- Inaccurate elevation representation: WMS data doesn’t accurately represent the road’s elevation, resulting in inconsistencies with the 3D terrain.
- Limited customization: WMS data doesn’t provide the level of customization I need for the dashed line pattern (e.g., dash length, gap length, color, width).
Due to these limitations, I’m seeking an alternative approach to generate 3D tiles with dashed multilinestring type surfacelinemark data in Cesium.
Additional details:
- The shapefile contains multiple road segments, each represented by a multilinestring geometry.
- I want to display each road segment as a dashed line with a consistent pattern in the 3D tiles.
- The dashed line pattern should be configurable (e.g., dash length, gap length).
I’ve searched for solutions online, but I haven’t been able to find anything that specifically addresses this issue. I’m hoping that someone in the Cesium community can help me out.
Thanks in advance for your help!
There currently is no predefined way for representing this kind of information in 3D Tiles. There are ways for representing polylines in 3D Tiles in principle . For example, there once has been a proposal for a vector tile format, but this is not broadly supported, and likely won’t meet all the requirements that you listed. Similarly, one could put this information into glTF/GLB files, but this also won’t include any rendering information.
The requirement for customization of the visual representation that you mentioned (dash lengths, width…) already indicate that one should carefully think about which aspects can sensibly be represented as a tile format. For example, one could pragmatically store some dashLength = 42.0
somewhere, in one form or antother, but that would not be enough, and almost certainly wouldn’t make sense when considering the user interaction (e.g. zooming and panning). (It would have to be “the dash length in pixels”, probably…)
Even though this sort of information cannot directly be encoded as part of 3D Tiles data, there are some threads about visualizing shapefiles in CesiumJS. Maybe you find some inspiration there: Depending on the size/complexity of the data, it might not be necessary to apply any form of “tiling”. It might be possible to visualize the data directly in CesiumJS.