-
Notifications
You must be signed in to change notification settings - Fork 0
Flight API
Ƭ Types: Object
Name | Type |
---|---|
AirportI |
AirportI |
AirportsI |
AirportsI |
DataE |
DataE |
FlightI |
FlightI |
HaulE |
HaulE |
SeatE |
SeatE |
▸ Const
getAirports(): AirportsI
Return the available airports
AirportsI
constant data loaded
▸ Const
getDistance(fromLat
, fromLon
, toLat
, toLon
): number
Compute distance in km from longitude and lattitude using the haversine formula.
description
the law of haversine in brief:
Given a unit sphere, a "triangle" on the surface of the sphere is defined by the great circles
connecting three points u, v, and w on the sphere.
If the lengths of these three sides are a (from u to v), b (from u to w), and c (from v to w),
and the angle of the corner opposite c is C, then the law of haversines states:
hav(c) = hav(a - b) + sin(a) * sin(b) * hav(C)
Since this is a unit sphere, the lengths a, b, and c are simply equal to the angles (in radians) subtended by those sides from the center of the sphere (for a non-unit sphere, each of these arc lengths is equal to its central angle multiplied by the radius R of the sphere).
Name | Type | Description |
---|---|---|
fromLat |
number |
Lattitude of the point of departure |
fromLon |
number |
Longitude of the point of departure |
toLat |
number |
Lattitude of the point of arrival |
toLon |
number |
Longitude of the point of arrival |
number
the distance in km
- getData
- getDataset
- getEmissionAvg
- getEmissionAvgByPassenger
- getEmissionEstimated
- getHaulFactor
- build
• new default(dataSet
, data
)
warning
Should not be used : please use the static build method using dataset enum type DataE
Name | Type |
---|---|
dataSet |
ADEME_2022 |
data |
DataI |
• Private
avgEmission: undefined
| number
• Private
avgEmissionByPassenger: undefined
| number
• Private
data: DataI
• Private
dataSet: ADEME_2022
▸ getData(): DataI
Return the current data constants loaded
DataI
constant data loaded
▸ getDataset(): ADEME_2022
Return the inner data set name
ADEME_2022
constant data loaded
▸ getEmissionAvg(): number
Return the average co2 estimation in peq.kgCO2e/year (per person).
description
This constant is the ratio totalEmission/#people
number
The average co2 emission in peq.kgCO2e/year (per person).
▸ getEmissionAvgByPassenger(): number
Return the average co2 estimation in peq.kgCO2e/year (per passenger).
description
This constant is the ratio totalEmission/#passenger
number
The average co2 emission in peq.kgCO2e/year (per passenger).
▸ getEmissionEstimated(travel
, nbFlights
): number
Compute the co2 emissions from air travels in kgCO2e/year
description
Firstly the distances are calculated between the airports selected, then we
use the factor emission expressed in kgCO2e/peq.km (peq = person equivalent) to
get our first estimation per equivalent person:
- Emission = Distance * Factor
- [kgCO2e/year] = [km/year] * [kgCO2e/km]
Finally, we add a factor depending on the class of the seat taken (economy class, business class, first class).
Name | Type | Description |
---|---|---|
travel |
FlightI |
- |
nbFlights |
number |
the number of flight made a year. |
number
the estimated flight emissions for the passengers in kgCO2e -1 in case of error (e.g. missing IATA airport)
▸ getHaulFactor(distance
): number
Retrieve the emission factor from the flight distance
Name | Type | Description |
---|---|---|
distance |
number |
distance of the flight in km |
number
emission factor in kgCO2e/peq.km
▸ Static
build(dataset
)
Create a calculator instance from dataset
Name | Type |
---|---|
dataset |
ADEME_2022 |
new House calculator - Throw error if dataset not loaded.
License MIT © Compte CO2 - M.J-L