diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 4cf5aa5b47f66216789e96a66e7d7f0238819b05..873be218ab9441be8e729aa92a2e4d01cb8c93a7 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -95,7 +95,7 @@ export class HomeComponent implements OnInit { */ private getStructurePosition(structure: Structure): Promise<Structure> { return new Promise((resolve, reject) => { - this.getCoord(structure.voie, structure.commune).subscribe((coord: GeoJson) => { + this.getCoord(structure.n, structure.voie, structure.commune).subscribe((coord: GeoJson) => { structure.address = coord.properties.name + ' - ' + coord.properties.postcode + ' ' + coord.properties.city; structure.distance = parseInt( this.geoJsonService.getDistance( @@ -116,8 +116,8 @@ export class HomeComponent implements OnInit { * Get coord with a street reference * @param idVoie Street reference */ - public getCoord(voie: string, zipcode: string): Observable<GeoJson> { - return this.geoJsonService.getCoord(voie, zipcode); + public getCoord(numero: string, voie: string, zipcode: string): Observable<GeoJson> { + return this.geoJsonService.getCoord(numero, voie, zipcode); } public getLocation(): void { diff --git a/src/app/map/components/map.component.ts b/src/app/map/components/map.component.ts index f41fb5da9e7c1bc6451209efb129dbc5d9ccb009..01a17f2f9f6b5ca9388e8e39065210250f76d99b 100644 --- a/src/app/map/components/map.component.ts +++ b/src/app/map/components/map.component.ts @@ -107,7 +107,7 @@ export class MapComponent implements OnChanges { private getStructuresPositions(structureListe: Structure[]): void { structureListe.forEach((element: Structure) => { - this.getCoord(element.voie, element.commune).subscribe((coord: GeoJson) => { + this.getCoord(element.n, element.voie, element.commune).subscribe((coord: GeoJson) => { this.mapService .createMarker(coord.geometry.getLon(), coord.geometry.getLat(), element.id, this.buildToolTip(element)) .addTo(this.map) @@ -151,8 +151,8 @@ export class MapComponent implements OnChanges { * Get coord with a street reference * @param idVoie Street reference */ - public getCoord(voie: string, zipcode: string): Observable<GeoJson> { - return this.geoJsonService.getCoord(voie, zipcode); + public getCoord(numero: string, voie: string, zipcode: string): Observable<GeoJson> { + return this.geoJsonService.getCoord(numero, voie, zipcode); } /** diff --git a/src/app/services/geojson.service.ts b/src/app/services/geojson.service.ts index ef92bb87a79598f340ceb656c7de0dbc7251abee..5f15ae6d84f1e101b7def155dde13eb0b2035609 100644 --- a/src/app/services/geojson.service.ts +++ b/src/app/services/geojson.service.ts @@ -47,9 +47,9 @@ export class GeojsonService { * Get GeoLocation with an address * @param address Address */ - public getCoord(address: string, zipcode: string): Observable<GeoJson> { + public getCoord(numero: string, address: string, zipcode: string): Observable<GeoJson> { return this.http - .get('/geocoding/photon/api' + '?q=' + address + ' ' + zipcode) + .get('/geocoding/photon/api' + '?q=' + numero + ' ' + address + ' ' + zipcode) .pipe(map((data: { features: any[]; type: string }) => new GeoJson(data.features[0]))); }