Search code examples
d3.jssvgleafletmapboxcesiumjs

Cesium labels on a polyline (similiar to a textpath)?


I would like to recreate bent country labels according to the area of the country.

In d3 (or SVG) I can construct a polyline and then use a textpath to have text along it. Example: https://www.w3.org/TR/SVG2/images/text/text-path-startoffset.svg

Is it possible in Cesium to do something similar?

In Leaflet it is implemented like that: http://makinacorpus.github.io/Leaflet.TextPath/


Solution

  • There's no native support for that in the current version of Cesium. It may be mentioned on a wishlist or on a roadmap somewhere, but there are no short-term plans that I know of to add it to Cesium.

    Even so, you may be able to find a workaround. For example, SVGs can be used as texturemap image sources in Cesium, so you could possibly use D3 to produce curved text on-the-fly and load the results into a Cesium billboard image or even a Cesium Globe inlay image. It would probably take some experimenting to figure out how to actually wire this up and how well it would work.