Cesium – How to make an InfoBox pop up on demand ?

                              .....
                           .'       '.
                          .           .
                          :           :
                          '           '
                ,.*====.   '.       .'   .====*.,
               .-`"/c)}}},    :...:    ,{{{(c\"`-.
           _.-'-6>   {{{{{'''`     `'''}}}}}   <9-'-._
          t         |}}}}}}           {{{{{{|         y
           \__.___.'{{{{{{{           }}}}}}}'.___.__/
               `[__/}}}}}}}}         {{{{{{{{\__]`
                {{{.'     `'-._   _.-'`     '.}}}
                }}/            ```            \{{
                {{|                           |}}
                }}|                           |{{
         .------{{{\    ,               ,    /}}}------.
        //.--------'    ;               ;   '---------.\\
       ((///  _          \             /          _  \\\))
 jgs    (((--' `''-------'`'"'-----'"'`'-------''` '--)))

It’s a bit of a hack, but you can make the info popup display whatever you like by creating a fake entity and setting it as the viewer’s selected entity. For example:

var entity = new Cesium.Entity('Title to put in the infobox');
entity.description = {
    getValue : function() {
        return 'HTML to display in the infobox';
    }
};
viewer.selectedEntity = entity;
Share

One thought on “Cesium – How to make an InfoBox pop up on demand ?

Leave a Reply

Your email address will not be published. Required fields are marked *