- 272:
- 273: function summarytxt(e){
- 274: var layer = e.target;
- 275: // pcco2=layer.feature.properties.co2pc;
- 276:
- 277: if (layer.feature.properties.co2pc<emissions){
- 278: ratio=emissions/layer.feature.properties.co2pc;
- 279: stringplus="This flight produces (per passenger) the same amount of greenhouse gases as "+ratio.toFixed(1)+" average resident of "+layer.feature.properties.name +" did in 2017.";
- 280: } else {
- 281: ratio=layer.feature.properties.co2pc/emissions;
- 282: stringplus="This average resident of "+layer.feature.properties.name +" produced the same amount of greenhouse gases in 2017 as "+ratio.toFixed(1) +" of these flights (per passenger)";
- 283: }
- 284:
- 285: hoverstring="<span id='hovername'>"+layer.feature.properties.name+":</span> "+layer.feature.properties.co2pc+" tonnes CO<sub>2</sub> per capita<br>"+stringplus;
- 286:
- 345:
- 346: //constants for equation
- 347: shDC=50;
- 348: lhDC=125;
- 349: ash=3.87871E-05;
- 350: alh=0.000134576;
- 351: bsh=2.9866;
- 352: csh=1263.42;
- 353: blh=6.1798;
- 354: clh=3446.20;
- 355: Ssh=158.44;
- 356: Slh=280.39;
- 357: Plf=0.77;
- 358: passF=0.951;
- 359: ecosh=0.96;
- 360: ecolh=0.8;
- 361: bussh=1.26;
- 362: buslh=1.54;
- 363: fcsh=2.4;
- 364: fclh=2.4;
- 365: EF=3.150;
- 366: pp=0.51;
- 367: Mnonco2=2;
- 389: eraseErrorMsg();
- 390:
- 391: origin=airportdata[fromindex];
- 392: destination=airportdata[toindex];
- 393:
- 394: origincoord=[origin.Lat,origin.Long];
- 395: destcoord=[destination.Lat,destination.Long];
- 396:
- 397: greatcircledist=getDistance(origincoord,destcoord)/1000; //units of km
- 398:
- 399: if (greatcircledist<1500){
- 400: CW=ecosh;
- 401: dist2=greatcircledist+shDC;
- 402: flightdist= (dist2);
- 403: emissions2=((ash*flightdist**2+bsh*flightdist+csh)/(Ssh*Plf))*passF*CW*(EF*Mnonco2+pp)*2/1000;
- 404:
- 405: } else {
- 406: CW=ecolh;
- 407: dist2=greatcircledist+lhDC;
- 408: flightdist= (dist2);
- 409: emissions2=((alh*flightdist**2+blh*flightdist+clh)/(Slh*Plf))*passF*CW*(EF*Mnonco2+pp)*2/1000;
- 410:
- 438:
- 439: function getDistance(origin, destination) {
- 440: // return distance in meters
- 441: var lon1 = toRadian(origin[1]),
- 442: lat1 = toRadian(origin[0]),
- 443: lon2 = toRadian(destination[1]),
- 444: lat2 = toRadian(destination[0]);
- 445:
- 446: var deltaLat = lat2 - lat1;
- 447: var deltaLon = lon2 - lon1;
- 448:
- 449: var a = Math.pow(Math.sin(deltaLat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(deltaLon/2), 2);
- 450: var c = 2 * Math.asin(Math.sqrt(a));
- 451: var EARTH_RADIUS = 6371;
- 452: return c * EARTH_RADIUS * 1000;
Bez tytułu
z Gamboge Armadillo, 2 dni temu, napisane w Plain Text, wyświetlone 1 razy.
[paste_expire] 10 miesiące.
URL https://pastebin.k4be.pl/view/6679a354
Udostępnij
Pobierz wklejkę lub Pokaż surowy tekst
— Rozwiń pełna szerokość przeglądarki