Using HTML on labels

Hi everyone,

    viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
        label : {
            text : '<h1>Philadelphia</h1>'
        }
    });

This example displays '<h1>Philadelphia</h1>'. Is there any posibilty using HTML on labels?

Thanks
Ihsan

It’s probably not directly possible. It may be possible to do something similar with a hack-ish workaround.

I recently had a need to draw the contents of some HTML elements into a canvas. It turns out that it’s doable, via some very twisted mechanics.

Fortunately, there’s some libraries on NPM that wrap up the logic for doing this. In particular, see https://github.com/bubkoo/html-to-image and https://github.com/tsayen/dom-to-image .

What you’d probably need to do is create your HTML elements, use one of those libraries to convert it to a canvas, and assign the canvas as the image of a billboard.

Good idea but I am having trouble with the performance when thousand of objects displayed. However, thanks for your reply.