-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from flightaware/BCK-5076
Create API to retrieve positions; Display positions on a Google Static map on the frontend
- Loading branch information
Showing
16 changed files
with
222 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
FH_USERNAME=user | ||
FH_APIKEY=key | ||
INIT_CMD_ARGS=events "flightplan departure arrival cancellation position" | ||
GOOGLE_MAPS_API_KEY=key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const degreesToRadians = (degrees) => { | ||
return (degrees * Math.PI / 180); | ||
} | ||
|
||
const radiansToDegrees = (radians) => { | ||
return (radians * 180 / Math.PI); | ||
} | ||
|
||
export const getBearingDegrees = (d_lat1, d_lon1, d_lat2, d_lon2) => { | ||
let r_lat1 = degreesToRadians(d_lat1); | ||
let r_lon1 = degreesToRadians(d_lon1); | ||
let r_lat2 = degreesToRadians(d_lat2); | ||
let r_lon2 = degreesToRadians(d_lon2); | ||
let dLon = (r_lon2 - r_lon1); | ||
|
||
let y = Math.sin(dLon) * Math.cos(r_lat2); | ||
let x = Math.cos(r_lat1) * Math.sin(r_lat2) - Math.sin(r_lat1) | ||
* Math.cos(r_lat2) * Math.cos(dLon); | ||
|
||
let brng = Math.atan2(y, x); | ||
|
||
brng = radiansToDegrees(brng); | ||
brng = (brng + 360) % 360; | ||
|
||
return brng; | ||
} | ||
|
||
export const getClosestDegreeAngle = (input_degrees) => { | ||
if ((input_degrees >= 315 && input_degrees < 360) || (input_degrees >= 0 && input_degrees < 45)) { | ||
return 0; | ||
} else if (input_degrees >= 45 && input_degrees < 135) { | ||
return 90; | ||
} else if (input_degrees >= 135 && input_degrees < 225) { | ||
return 180; | ||
} else { | ||
return 270; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
sqlalchemy==1.3.16 | ||
Flask==1.1.2 | ||
flask-cors==3.0.8 | ||
psycopg2-binary==2.8.5 |
Oops, something went wrong.