mirror of
https://github.com/DerTyp7/street-map-typescript.git
synced 2025-10-29 12:52:11 +01:00
finished auto suggestions
This commit is contained in:
@@ -13,6 +13,8 @@ interface PhotonProperties{
|
||||
osm_value?: string;
|
||||
name?: string;
|
||||
type?: string;
|
||||
postcode?: string;
|
||||
city?: string;
|
||||
}
|
||||
|
||||
export interface Photon{
|
||||
|
||||
@@ -13,6 +13,6 @@ export class PhotonService{
|
||||
|
||||
// sends a query request to Photon and gets response (https://photon.komoot.io/)
|
||||
sendQueryRequest(q: string): Observable<PhotonFeatureCollection> {
|
||||
return this.http.get<PhotonFeatureCollection>("https://photon.komoot.io/api/?q=" + q);
|
||||
return this.http.get<PhotonFeatureCollection>("https://photon.komoot.io/api/?q=" + q + "&limit=10");
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@
|
||||
<input type="hidden" value="{{ item.display_name }}">
|
||||
</div>
|
||||
|
||||
<div *ngFor="let item of photonItemsTo" >
|
||||
{{ item.properties.name }}
|
||||
<div *ngFor="let item of photonItemsFrom" >
|
||||
{{ item.properties.name }} {{item.properties.postcode}} {{item.properties.city}} {{item.properties.countrycode}}
|
||||
<input type="hidden" value="{{ item.properties?.name }}">
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
|
||||
<div *ngFor="let item of photonItemsTo" >
|
||||
{{ item.properties.name }}
|
||||
{{ item.properties.name }} {{item.properties.postcode}} {{item.properties.city}} {{item.properties.countrycode}}
|
||||
<input type="hidden" value="{{ item.properties?.name }}">
|
||||
</div>
|
||||
|
||||
|
||||
@@ -35,13 +35,15 @@ export class SearchComponent implements OnInit {
|
||||
this.nominatimService.sendQueryRequest(valueTo)
|
||||
.subscribe((response: Nominatim[]) => this.nominatimItemsTo = response);
|
||||
*/
|
||||
this.photonItemsFrom = [];
|
||||
this.photonItemsTo = [];
|
||||
|
||||
this.photonService.sendQueryRequest(valueFrom)
|
||||
.subscribe((response: PhotonFeatureCollection) => response.features?.forEach(feature => {
|
||||
this.photonItemsFrom.push(feature);
|
||||
}));
|
||||
|
||||
this.photonService.sendQueryRequest(valueFrom)
|
||||
this.photonService.sendQueryRequest(valueTo)
|
||||
.subscribe((response: PhotonFeatureCollection) => response.features?.forEach(feature => {
|
||||
this.photonItemsTo.push(feature);
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user