I am developing a flight demo, I shown plane entity flight trace by czml data, I also want to display lat and lon info with the label followed entity. but i failed, can anyone give me some tips? thank you.
I would update the label text in a callbackProperty. The plane will have a Property for it’s position, that is a Cartesian3. You can retrieve that value, then convert it to a Cartographic to get the lat/long, like so:
function getPositionLength(time) {
var position = plane.position.getValue(time);
var location = Cesium.Cartographic.fromCartesian(position);
return "lat: " + location.latitude + " long: " + location.longitude;
}
plane.label.text = new Cesium.CallbackProperty(getPosition, false);
Thank u for your example, it works. since CallbackProperty is designed to be called every frame, so I finally use setInterval() to update the label text. much appreciate.
thanks!
Jorbin
setInterval(function() {
var position = plane.position.getValue(viewer.clock.currentTime);
var location = Cesium.Cartographic.fromCartesian(position);