1. A concise explanation of the problem you’re experiencing.
I have a CZML file that define polylines. The coordinates for the polylines look like this…
polyline: {
positions: {
cartographicDegrees: [-1.87, -3.02, 0, -4.43, 1.28, 0]
},
material: {
solidColor: {
color: {
rgba: [255, 0, 0, 255]
}
}
},
width: 2,
clampToGround: true
}
``
I need to grab those coordinates to display them elsewhere on my GUI…
I sort out my polylines into an array and pick them up like this…
var pos = mylines[0].polyline.positions;
``
then I have two helper functions to convert the from cartesian coordinates and then place them in another array.
$.each( pos._value, function( key, value ) {
c3 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(value)
c2 = parseCartographic(c3);
console.log("c2: " + c2);
cart.push(c2);
});
function parseCartographic(str) {
var res = str.toString().split(",");
var ret = “[” +res[0].replace("(","") + “,” + res[1].replace("(","") + “]”;
return ret ;
}
``
The cart variable comes out looking like this
**"cart: [[-0.030368728984701332, -0.05270894341022874],[0.01710422666954443, 0.03036872898470134]]"**
Why are the coordinates all jacked up?
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
see above
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I want to draw a line based on this first line I get.
4. The Cesium version you’re using, your operating system and browser.
1.47, Windows10, latest Firefox.
Any help you can provide would be appreciated. Thanks,
Jody