Runtime pathdraw

Hi people,

I’m looking for some help. I have to make a flighttracker for a schoolproject so you can follow your own flight.
I followed this tutorial to get me started: Build a Flight Tracker – Cesium
Once this worked fine I started adjusting it to my needs, mainly that the script gets GPS-data instead of using pre-determined data. Because I don’t own a plane myself I obviously have to fake this a bit by using pre-determined data again, but I’m feeding it one coordinate at a time so simulate a GPS-sensor.

Once I tweaked the script I ran into some bugs that I can’t seem to find. The two main issues I have now are 1) the path isn’t drawn anymore and 2) the airplane is super tiny so you can only see it when you zoom in really far. Even tough I set it to a ridiculous size.
I assume these 2 problems are related since both the model and drawing the path happens (or should happen…) in the same function.

Can anybody give me a hand with this? I’m still pretty new to Javascript and completely new to Cesium.
Sandcastle link

Hi, Welcome in Cesium community!
I’ve gone through the sandcastle example and found few things that needs to be changed.

Airplane model uri was incorrect, that should be:
const airplaneUri = "../SampleData/models/CesiumAir/Cesium_Air.glb";

Keep scale property inside the model tag:
model: { uri: airplaneUri, scale: 10.0 },

Your are reloading model inside a loop:
Also, I’m not getting what do you mean by “the path isn’t drawn anymore”. Do you want to draw path as a line following to the points you are creating dynamically?

You can check this modified example and let us know if there is something I’ve left.

  • Regards
1 Like

Tnx Jacky! I have a decent sized airplane again :slight_smile: That’s one thing fixed!

Follow up question about the model: you say the the uri should be “…/sampledata/ etc”. Does Cesium only accept a certain folder, or is that just for the sandcastle example? I realise now that I just copy/pasted my code in the sandcastle environment so yeah, it’s obviously not able to find my local files (like the model).

About the path: when I followed the tutorial there was a white line connecting the dots. After I made the changes to simulate a live flight it doesn’t do that anymore. I don’t like the look of the dots, they’re quite ugly so ideally I want the path back and make the dots small again.

That’s not about Cesium file accessibility. Cesium is running on front-end hence whatever the file location you want to set, should be publicly accessible.

If you want to display a line (path), Path should be a separate entity with the same sampledPositionProperty. Check again this re-modified example.

1 Like

You are awesome man! That is exactly what I was looking for! Thank you very much!

1 Like

I’m glad to help you. :beers: