diff --git a/classes.py b/classes.py index 15ce554..2a1af40 100644 --- a/classes.py +++ b/classes.py @@ -75,11 +75,12 @@ class Location: Seitenkosinussatz """ rErde = 6378.388 - lat1 = float(self.coord.lat) - long1 = float(self.coord.long) - lat2 = float(loc2.coord.lat) - long2 = float(loc2.coord.long) - inner = math.sin(lat1) * math.sin(lat2) + math.cos(lat1) * math.cos(lat2) * math.cos(long2 - long1) + lat1 = math.radians(float(self.coord.lat)) + long1 = math.radians(float(self.coord.long)) + lat2 = math.radians(float(loc2.coord.lat)) + long2 = math.radians(float(loc2.coord.long)) + inner = math.sin(lat1) * math.sin(lat2) + \ + math.cos(lat1) * math.cos(lat2) * math.cos(long2 - long1) return rErde * math.acos(inner) diff --git a/file.txt b/file.txt index cb1ed77..e5351bc 100644 --- a/file.txt +++ b/file.txt @@ -1,7 +1,7 @@ Locations: csu_zen ; Location; 48.176971; 11.5895754; 1; CSU-Zentrale mun_hbf ; PublicTransportStop; 48.140235; 11.559417; 1; Muenchen Hbf. -mun_flugh; Airport; 48.140235; 11.770723; 1; Muenchen Flughafen +mun_flugh; Airport; 48.35333; 11.770723; 1; Muenchen Flughafen reichstag; Location; 52.518191; 13.3751725; 1; Reichstags Gebaeude ber_flugh; Airport; 52.553625; 13.2901544; 1; Berlin Flughafen Tegel ber_hbf ; PublicTransportStop; 52.524195; 13.3693013; 1; Berlin Hbf diff --git a/graph.py b/graph.py index 3badb23..d509ed5 100644 --- a/graph.py +++ b/graph.py @@ -15,7 +15,7 @@ def calc_co2(distance: float, kind: TransportKind) -> float: return 0 else: # TODO: CITY == AUTOBAHN - return distance * TransportMethod.CITY.value.co2 + return (distance - 1) * TransportMethod.CITY.value.co2 case TransportKind.TRAIN: # TODO: OPENV == ICE return distance * TransportMethod.ICE.value.co2