diff --git a/src/app/pages/simulation-wizard/results-map/results-map.component.ts b/src/app/pages/simulation-wizard/results-map/results-map.component.ts index c5584b286657216b23e33e2c23fa510c8e7c5526..526199beb290b37ef9ed46be6bb300e0ca6a65bd 100644 --- a/src/app/pages/simulation-wizard/results-map/results-map.component.ts +++ b/src/app/pages/simulation-wizard/results-map/results-map.component.ts @@ -625,18 +625,23 @@ export class ResultsMapComponent implements OnChanges { } setMapZoom() { - if (this.selectedSimulation["city"]["cityId"] == "amsterdam") { - this.map.setView(new L.LatLng(52.4, 4.9), 9); - } else if (this.selectedSimulation["city"]["cityId"] == "bilbao") { - this.map.setView(new L.LatLng(43.3, -2.9), 9); - } else if (this.selectedSimulation["city"]["cityId"] == "helsinki") { - this.map.setView(new L.LatLng(60.2, 24.9), 9); - } else if (this.selectedSimulation["city"]["cityId"] == "messina") { - this.map.setView(new L.LatLng(38.2, 15.6), 9); - } else { - this.toastrService.show("Unexpected value for city name.", "Error", { - status: "danger", - }); + if (this.selectedSimulation != undefined) { + if (this.selectedSimulation["city"]["cityId"] == "amsterdam") { + this.map.setView(new L.LatLng(52.4, 4.9), 9); + } else if (this.selectedSimulation["city"]["cityId"] == "bilbao") { + this.map.setView(new L.LatLng(43.3, -2.9), 9); + } else if (this.selectedSimulation["city"]["cityId"] == "helsinki") { + this.map.setView( + new L.LatLng(60.16005488265436, 24.920971999284017), + 13 + ); + } else if (this.selectedSimulation["city"]["cityId"] == "messina") { + this.map.setView(new L.LatLng(38.2, 15.6), 9); + } else { + this.toastrService.show("Unexpected value for city name.", "Error", { + status: "danger", + }); + } } } @@ -671,5 +676,7 @@ export class ResultsMapComponent implements OnChanges { Object.entries(this.loadGeojsons).forEach((entry) => { entry[1]["response"] = undefined; }); + + this.setMapZoom(); } }