My basic function Drawline doesn't work anymore [beginner]

22 views
Skip to first unread message

cosso...@eisti.eu

unread,
May 22, 2019, 6:29:24 AM5/22/19
to cesium-dev
Hello everyone,
I recently started to dev on Cesium for an important project on my start up, but suddently, I think after an update from Cesium, my basic function therefore doesn't work anymore and I can't find a way to debug it.

I think the problem is around the positions of polyline but I don't really know what to change since it worked perfectly just a few weeks ago.
I'm using Cordova and Firefox in Ubuntu for testing but this code doesn't work in SandCastle neither.
I linked my entire index.html files if you want to see more details.
Thank you so much :)

function drawLine(EntryPosition,ExitPosition){
var flighAltitude = 500;
var CartographicEntry = Cesium.Ellipsoid.WGS84.cartesianToCartographic(EntryPosition);
var CartographicExit = Cesium.Ellipsoid.WGS84.cartesianToCartographic(ExitPosition);
var lineParams = {
name : 'Tunnel',
polyline : {
positions : Cesium.Cartesian3.fromDegreesArrayHeights([Cesium.Math.toDegrees(CartographicEntry.longitude),Cesium.Math.toDegrees(CartographicEntry.latitude), flightAltitude,
Cesium.Math.toDegrees(CartographicExit.longitude),Cesium.Math.toDegrees(CartographicExit.latitude), flightAltitude]),
width : 4,
material : new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.CYAN
})
}
};
viewer.entities.add(lineParams);
secondaryViewer.entities.add(lineParams);
}


index.html

Omar Shehata

unread,
May 22, 2019, 8:19:28 AM5/22/19
to cesium-dev
Can you tell me what version of CesiumJS you're currently using, and what version you were using when it was working? This will help narrow down what things have changed by looking at the change list here https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CHANGES.md

Can you tell me what you mean by "doesn't work" ? Does it produce an error? Is a line not drawn?

I put your code in Sandcastle here, and after fixing a typo with the "flightAltitude" variable, I can see a line drawn when I hit the "go there" button. 

Omar Shehata

unread,
May 22, 2019, 8:19:58 AM5/22/19
to cesium-dev
Also, your application looks pretty interesting! What kind of project are you working on?

cosso...@eisti.eu

unread,
May 22, 2019, 12:05:41 PM5/22/19
to cesium-dev
Oh my god that was so stupid :') just so you know, we were 5 people trying to solve this problem without seeing this obvious informaticien mistake :')
I was trying to debug the whole "complicated" line just below

Me and my student team are trying to develop a sort of Waze for plane pilotes, where in the long term it should be able to be used by a drone so it is piloted by its own and be able to literally dodge every building, planes, helicopters and other drones in its way.
Anyway, thank you so much for your help and concern :)

Since I'm here, do you have any idea if it is possible with Cesium to have an online server (prolly Node.js for praticity) where our mobile application takes in-time data (like positions of other planes which change every second) so we can literally see other planes moving in this app? Thank you again ;)

Omar Shehata

unread,
May 22, 2019, 1:43:54 PM5/22/19
to cesium-dev
I'm glad I could help! 

That sounds like a really cool application - once it's done you should reach out to me at om...@cesium.com or post about it here, it would be awesome to showcase it or maybe even do a guest blog post on the Cesium blog (https://cesium.com/blog/)! 

As for hooking up Cesium with an online server for real-time data, that is definitely possible! I've been meaning to write a tutorial specifically about all the features in Cesium that make it easy to work with real time data, but some of the code examples on Sandcastle should be helpful here. Particularly this one which shows you how to have position/rotation data tagged with timestamps, and be able to see them across time, controlled by the timeline:


Cesium can interpolate between timestamps, so typically what you'd do is buffer data so the visualization is 10 to 30 seconds behind the real time feed so it can smoothly interpolate between each point as it comes in.
Reply all
Reply to author
Forward
0 new messages