From 2a8aca399c196a20d10d1774c177805ba1cf7809 Mon Sep 17 00:00:00 2001 From: Andrew Chae Date: Thu, 22 Oct 2015 19:49:18 -0700 Subject: [PATCH] Use short name for thoroughfare if it's used in the formatted address --- SVGeocoder/SVPlacemark.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SVGeocoder/SVPlacemark.m b/SVGeocoder/SVPlacemark.m index 1f34cb9..0bfec19 100644 --- a/SVGeocoder/SVPlacemark.m +++ b/SVGeocoder/SVPlacemark.m @@ -48,8 +48,14 @@ - (id)initWithDictionary:(NSDictionary *)result { if([types containsObject:@"street_number"]) self.subThoroughfare = [component objectForKey:@"long_name"]; - if([types containsObject:@"route"]) - self.thoroughfare = [component objectForKey:@"long_name"]; + if([types containsObject:@"route"]) { + NSString *shortName = [component objectForKey:@"short_name"]; + if ([self.formattedAddress containsString:shortName]) { + self.thoroughfare = shortName; + } else { + self.thoroughfare = [component objectForKey:@"long_name"]; + } + } if([types containsObject:@"administrative_area_level_3"] || [types containsObject:@"sublocality"] || [types containsObject:@"neighborhood"]) self.subLocality = [component objectForKey:@"long_name"];