hannphry / AWE-Projekt

Gruppe 2, Semester 4, Projekt Anwendungsentwicklung
0 stars 0 forks source link

Auswertungen der Bahnhöfe #8

Open hannphry opened 2 years ago

hannphry commented 2 years ago

Angular Component: Stations

hannphry commented 2 years ago

Stations (Preisklassen, behindertengerecht, Parkplätze, Fahrradparkplätze, ÖPNV-Anschluss, Wieviele Stationen sind in welchen Bundesländern?)

hannphry commented 2 years ago

export interface StationModel{ id: string, name: string, shortcut: string, lon: number, lat: number, type?: string, priceCategory ?: number, hasSteplessAccess ?: boolean, hasParking ?:boolean, hasBicycleParking ?:boolean, hasLocalPublicTransport ?:boolean, hasTaxiRank ?: boolean, hasCarRental ?: boolean, hasWiFi ?: boolean, federalState ?: string, stationManagement ?:string, has247service?: boolean }

image

hannphry commented 2 years ago

Aktuell sind 4197 Bahnhöfe in der Datenbank

hannphry commented 2 years ago
this.stationService.getStations().subscribe(data =>{
  this.stations = data; //Unsere Bahnhofsstationen für die Komponente setzen
  this.stationsByFederalState.splice(0,1); //Das erste Element für die Bundesländer und Stationen leeren, weil das erste nicht gebraucht wird

  let stateStations: any[] = [];

  console.log(this.stations);

  this.federalStates.forEach(state=>{ //Jedes Bundesland im Bundesland-Array durchgehen
    let tmpStations = this.stations.filter(obj=> obj.federalState == state ); //Die Stationen rausfiltern, die im richtigen Bundesland liegen
    this.stationsByFederalState.push({ // Zu dem Objekt hinzufügen
      federalState: state,
      stations : tmpStations
    });

    //Wieviele davon haben ÖPNV-Anschluss?

    let publicTransportStations = tmpStations.filter(obj => obj.hasLocalPublicTransport == true);

    stateStations.push([state, tmpStations.length, publicTransportStations.length, (tmpStations.length - publicTransportStations.length)]);

  });
  this.comboChart.values = stateStations;

  let priceCategoryStations: any[] = [];

  this.priceCategories.forEach(category =>{
    let tmpStations = this.stations.filter(station => station.priceCategory == category);
    let taxiRankStations = tmpStations.filter(station => station.hasTaxiRank == true);
    let stations247 = tmpStations.filter(station => station.has247service == true);

    priceCategoryStations.push([category, tmpStations.length, taxiRankStations.length, stations247.length]);
  })
  this.steppedAreaChart.values = priceCategoryStations;

  let stationTypeStations: any[] = [];

  this.stationTypes.forEach(type =>{
    let tmpStations = this.stations.filter(obj => obj.type == type);
    let taxiRankStations = tmpStations.filter(station => station.hasTaxiRank == true);
    let carRentalStations = tmpStations.filter(station => station.hasCarRental == true);

    stationTypeStations.push([type, tmpStations.length, taxiRankStations.length, carRentalStations.length])
  });
  this.areaChart.values = stationTypeStations

  //console.log(this.steppedAreaChart);
});
hannphry commented 2 years ago

federalStates: string[] = [ "Bayern", "Baden-Württemberg", "Berlin", "Brandenburg", "Bremen", "Hamburg", "Hessen", "Mecklenburg-Vorpommern", "Niedersachsen", "Nordrhein-Westfalen", "Rheinland-Pfalz", "Saarland", "Sachsen", "Sachsen-Anhalt", "Schleswig-Holstein", "Thüringen" ]

priceCategories: number[] = [ 1, 2, 3, 4, 5, 6, 7 ];

stationTypes: string[] = [ "Knotenbahnhof", "Zubringerbahnhof", "S-Bahnhof", "Metropolbahnhof" ];

stationsByFederalState :[{ federalState: string, stations: Station[] }] = [{ federalState: "", stations: [] }];

comboChart: Chart = { title: 'Bundesländer', type: ChartType.ComboChart, options: { title : 'Anzahl Stationen mit ÖPNV-Anschluss', vAxis: {title: 'Anzahl'}, hAxis: {title: 'Bundesländer'}, seriesType: 'bars', series: {2: {type: 'line'}}, colors: [ '#aecbfc', //'#aedcfc', //'#aeeafc', '#aef2fc', //'#aefcf4', //'#aefce1', '#aefcc3' ],

},
columns: ['Bundesland','Stationen','ÖPNV', 'Differenz'],
values: []

}

steppedAreaChart: Chart= { title: 'Anzahl Stationen mit Taxi und 24/7 Service nach Preisklasse', type: ChartType.SteppedAreaChart, options: { colors: [ '#aecbfc', //'#aedcfc', //'#aeeafc', '#aef2fc', //'#aefcf4', //'#aefce1', '#aefcc3' ], }, columns: ['Preisklasse','Anzahl Stationen','Mit Taxi','24/7-Service'], values: [] }

areaChart: Chart = { title: 'Mit Taxi und Mietwagen nach Bahnhofstypen', type: ChartType.AreaChart, options: { //isStacked: true, colors: [ '#aecbfc', //'#aedcfc', //'#aeeafc', '#aef2fc', //'#aefcf4', //'#aefce1', '#aefcc3' ], }, columns: ['Anzahl','Typ', 'Anzahl Mit Taxi','Anzahl mit Mietwagen'],

hannphry commented 2 years ago
hannphry commented 2 years ago

Neue Ideen für Graphen:

hannphry commented 2 years ago

Unterschiede in Längen und Breitengraden: image

Kassel - München ~400 km Luftlinie Differenz Lat (Breitengrade) : 2,068834 Differenz Lon (Längengrade) : -3,178028

hannphry commented 2 years ago

Kleinere Änderungen: