You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I love the project, Thanks for helping me out bc I'm doing something similar :)
I found how to do the opensky api call from the browser, just leaving it in case anyone is interested
export async function getFlights( coords ) {
// get the user's longitude and latitude
const [ longitude, latitude ] = [ coords.longitude, coords.latitude ];
// find the min and max longitude and latitude of the search area
const kmPerDegreeLatitude = 111.2
const kmPerDegreeLongitude = 111.2 * Math.cos( latitude / 180 * Math.PI )
const latitudeDegrees = SEARCH_DISTANCE / kmPerDegreeLatitude
const longitudeDegrees = SEARCH_DISTANCE / kmPerDegreeLongitude
// build the query string
const parameters = {
lamin: latitude - latitudeDegrees,
lomin: longitude - longitudeDegrees,
lamax: latitude + latitudeDegrees,
lomax: longitude + longitudeDegrees
}
const queryString = new URLSearchParams(parameters).toString();
// make the request and set the openskyResponse variable
const response = await fetch( OPENSKY_URL + "?" + queryString, {method: "GET", headers: HEADERS} );
const openskyResponse = await response.json();
return openskyResponse;
}
The text was updated successfully, but these errors were encountered:
Hi, I love the project, Thanks for helping me out bc I'm doing something similar :)
I found how to do the opensky api call from the browser, just leaving it in case anyone is interested
The text was updated successfully, but these errors were encountered: