Skip to content

Commit 5b6ef1e

Browse files
committed
fix(location): correctly display towns in address search result
1 parent d3f5dc5 commit 5b6ef1e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/app/features/location/geo.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ export class GeoService {
6969
private reformatDisplayName(result: OpenStreetMapsSearchResult): GeoResult {
7070
const addr = result?.address;
7171
if (addr) {
72+
const city = addr.city ?? addr.town;
73+
7274
result.display_name = [
7375
addr.amenity ?? addr.office,
7476
addr.road ? addr.road + " " + addr.house_number : undefined,
75-
addr.postcode ? addr.postcode + " " + addr.city : addr.city,
77+
addr.postcode ? addr.postcode + " " + city : city,
7678
]
7779
.filter((x) => !!x)
7880
.join(", ");
@@ -110,6 +112,7 @@ type OpenStreetMapsSearchResult = GeoResult & {
110112
suburb?: string;
111113
borough?: string;
112114
city?: string;
115+
town?: string;
113116
postcode?: number;
114117
country?: string;
115118
country_code?: string;

0 commit comments

Comments
 (0)