Hi all. I’m updating the location of a bunch of points from streaming data. So far I’ve been manually fetching already-created entities and updating them, e.g.:
let primitive = collection.entities.getById(entityKey);
if (primitive) {
primitive.position = cartesian;
} else {
collection.entities.add({
. . .
I just stumbled across CallbackPositionProperty, which would presumably let me do the same thing in a different way. Is one technique substantially more performant than the other?
Hi @BoatyTob,
Thanks for your post and for being a part of the Cesium community.
The CallbackPositionProperty has a bunch of benefits tied to performance. Some of which are demonstrated and explained in this sandcastle example
I’ll highlight/repeat what it says there:
// This example illustrates a Callback Position Property, a position property whose
// value is lazily evaluated by a callback function.
// Use a CallbackPositionProperty when your data can't be pre-computed
// or needs to be derived from other properties at runtime.
Performance depends on your data and use case, so I suggest giving it a try in your code. Please let us know how that goes and if we can be of any more help.
Thanks,
Luke