0

I am working on kml file integration on cesium maps. I already have a json file with approach_path data for airplanes. I want to convert this file into a kml file so that I can load the corresponding data onto the cesium map showing the approach paths onto the map itself. (There is a valid reason why i don't want to load the json file directly that I have. I want to load the kml file only!).

So for creating a line using kml file onto the cesium map I have to use a tag named : <LineString> along with the other tags this linestring has another subtag named : <coordinates> which requires 2 values i.e from where to start and where to end.

But in my json file the data that I have is as follows :

[
  {
    "Rwy": "30R",
    "Altitude": 82,
    "Gradient": 3,
    "Course": 299,
    "Distance": 9.2,
    "Variation": 2,
    "lat": 25.24775,
    "lng": 55.38086111111111,
    "DMS": "25°14'51.9\"N 55°22'51.1\"E"
  }
]

Now the above data represents a single line where it is just using a single coordinate (lat and lng) it is not using a start coordinate and a end coordinate to create a line like we need it in case of a linestring what I think is in the json file they are using directional data as well as i dont know what rwy course DMS and variation represent maybe it is used to create a vector which has a start point and extends in a particular direction for a certain range.

Now the real question is how can i create a vector in kml? which has only 1 start point and extends in a particular direction for a particular range.

Anykind of help will be appreciated :)

Sushant Bassi
  • 364
  • 3
  • 16
  • 2
    Go back to your High School Geometry. You are converting a Polar Coordinate System to a Rectangular Coordinate System. You have a center of a circle (latitude, longitude), a radius (Distance), and an angle (Course). So x = r * Cosine(Angle), and y = r * Sine(Angle). – jdweng Nov 21 '19 at 09:54
  • I'll try it out buddy! I hope it works out btw i am good at maths :D – Sushant Bassi Nov 21 '19 at 10:06
  • What units is "Distance" in? – geocodezip Nov 22 '19 at 03:38
  • I have used a static value according to my needs : "0.05" which shows a small line, when i used the distance that is coming form the json file it used to create a very long line(in this case i am getting a distance of 9.2). may be the distance units is in "kms" thats why it showed a long line! – Sushant Bassi Nov 22 '19 at 10:01
  • @jdweng It did work smoothly. I calculated the 2nd coordinate cooresponding to the coordinates that i am getting from the json file and then used the line string to create the corresponding line. Got everything dynamic and put it into a foreach loop. Thanks a lot for the help, much appreciated. :) – Sushant Bassi Nov 22 '19 at 11:36
  • I looks like you had a scaling issue meters (not km) to miles like I expected. – jdweng Nov 22 '19 at 13:16

0 Answers0