const destinations = [
{
id: 0,
city: "Buenos Aires",
country: "Argentina",
codeIATA: "AEP",
aeroName: "Aeroparque Jorge Newbery",
coordX: 15,
coordY: 36,
},
{
id: 1,
city: "El Calafate",
country: "Argentina",
codeIATA: "FTE",
aeroName: "Comandante A. Tola",
coordX: -49,
coordY: -63,
},
With an array of several objects that constitute cities/airports like the 2 objects above, the user will have to select one object as origin and the other as destination. What I'm trying to find out is how to catch the x and y coordinates of each chosen origin and destination to calculate the distance between the two points and be able to provide distance in km, time and flight cost.