In angular application I have called the API and fetched the data something likethis:
{
"Drone": {
"Droneid": 1001,
"latlong": [
{
"lat": 12.989839,
"lon": 80.198822
},
{
"lat": 13.051832,
"lon": 80.194480
},
{
"lat": 13.038453,
"lon": 80.227442
},
{
"lat": 13.009018,
"lon": 80.242550
},
{
"lat": 12.976903,
"lon": 80.237056
},
{
"lat": 12.956829,
"lon": 80.193107
},
{
"lat": 12.980917,
"lon": 80.150531
},
{
"lat": 13.007680,
"lon": 80.149158
},
{
"lat": 13.043805,
"lon": 80.154651
}
]
}
}
And I have placed the latlong array from the above object in variable
var latlngs = this.drones.Drone.latlong;
Now I have to calculate the distance from index-0 to index-2(from the latlong array) and index-0 to index-3,index-0 to index-4 and so on(I have to calculate distance from index-0 to all starting from index-2) Can anyone help me regarding this.