diff --git a/src/app/interfaces/photon.ts b/src/app/interfaces/photon.ts index c4628ed..301025f 100644 --- a/src/app/interfaces/photon.ts +++ b/src/app/interfaces/photon.ts @@ -1,5 +1,5 @@ interface PhotonGeometry{ - coordinates?: Array; + coordinates: Array; type?: string; } diff --git a/src/app/search/search.component.css b/src/app/search/search.component.css index c2093e1..c3cc574 100644 --- a/src/app/search/search.component.css +++ b/src/app/search/search.component.css @@ -31,7 +31,7 @@ } .autocomplete-items { - display:none; + display:block; /* without debugging it should be display:none */ position: absolute; border: 1px solid #d4d4d4; border-bottom: none; diff --git a/src/app/search/search.component.html b/src/app/search/search.component.html index 79438e1..2efdacb 100644 --- a/src/app/search/search.component.html +++ b/src/app/search/search.component.html @@ -1,21 +1,27 @@
+
+ + + + + +
- +
{{ item.display_name }}
-
+
{{ item.properties.name }} {{item.properties.postcode}} {{item.properties.city}} {{item.properties.countrycode}} -
-
+
@@ -24,7 +30,7 @@
-
+
{{ item.properties.name }} {{item.properties.postcode}} {{item.properties.city}} {{item.properties.countrycode}}
diff --git a/src/app/search/search.component.ts b/src/app/search/search.component.ts index ae8f326..3008680 100644 --- a/src/app/search/search.component.ts +++ b/src/app/search/search.component.ts @@ -19,9 +19,22 @@ export class SearchComponent implements OnInit { photonItemsFrom: Photon[] = []; photonItemsTo: Photon[] = []; + longFrom: number = 0; + latFrom: number = 0; + longTo: number = 0; + latTo: number = 0; + constructor(private nominatimService: NominatimService, private photonService: PhotonService) { } - + changeInputs(isFrom: boolean, long: number, lat: number): void{ + if(isFrom){ + this.longFrom = long; + this.latFrom = lat; + }else{ + this.longTo = long; + this.latTo = lat; + } + } // Gets called in "app.component.html" when an input changes its value getValue(valueFrom:string, valueTo:string): void{ console.log("From " + valueFrom + " to " + valueTo); @@ -41,15 +54,16 @@ export class SearchComponent implements OnInit { this.photonService.sendQueryRequest(valueFrom) .subscribe((response: PhotonFeatureCollection) => response.features?.forEach(feature => { this.photonItemsFrom.push(feature); + this.longFrom = this.photonItemsFrom[0].geometry?.coordinates![0]; + this.latFrom = this.photonItemsFrom[0].geometry?.coordinates![1]; })); this.photonService.sendQueryRequest(valueTo) .subscribe((response: PhotonFeatureCollection) => response.features?.forEach(feature => { this.photonItemsTo.push(feature); + this.longTo = this.photonItemsTo[0].geometry?.coordinates![0]; + this.latTo = this.photonItemsTo[0].geometry?.coordinates![1]; })); - - console.log(this.photonItemsFrom) - } ngOnInit(): void { }