clgeocoder

“Name” of a CLPlacemark

烈酒焚心 提交于 2019-12-01 00:58:00
I'm trying to understand CLPlacemark and when/how to create information for a callout of a pin that is added to a map. Before what I read in More iOS 3 development a few years ago, they reverse geocoded an address and built the address (street, zip, state, etc). First, do I need to build this string myself? I was trying to find out how to get the name of a location for certain known things like searching for the apple store in the code below: NSString *address = @"1 stockton, san francisco, ca"; CLGeocoder *geocoder = [[CLGeocoder alloc] init]; [geocoder geocodeAddressString:address

CLGeocoder in Swift - unable to return string when using reverseGeocodeLocation

不想你离开。 提交于 2019-12-01 00:50:14
I'm attempting to use CLGeocoder to return the location of coordinates in a string. My code currently looks like this: func getPlaceName(latitude: Double, longitude: Double) -> String { let coordinates = CLLocation(latitude: latitude, longitude: longitude) var answer = "" CLGeocoder().reverseGeocodeLocation(coordinates, completionHandler: {(placemarks, error) -> Void in if (error != nil) { println("Reverse geocoder failed with an error" + error.localizedDescription) answer = "" } if placemarks.count > 0 { let pm = placemarks[0] as CLPlacemark answer = displayLocationInfo(pm) } else { println(

“Name” of a CLPlacemark

一曲冷凌霜 提交于 2019-11-30 19:10:03
问题 I'm trying to understand CLPlacemark and when/how to create information for a callout of a pin that is added to a map. Before what I read in More iOS 3 development a few years ago, they reverse geocoded an address and built the address (street, zip, state, etc). First, do I need to build this string myself? I was trying to find out how to get the name of a location for certain known things like searching for the apple store in the code below: NSString *address = @"1 stockton, san francisco,

CLGeocoder Only Returning One Placemark

蓝咒 提交于 2019-11-30 13:22:46
问题 I have a problem with CLGeocoder where when I call geocodeAddressString:withCompletionHandler I only ever get one result back, despite knowing that the inputted string should return more than one value. The class reference even states: In the case of forward-geocoding requests, multiple placemark objects may be returned if the provided information yielded multiple possible locations. However, my placemarks array only ever has one item in it: [geocoderDestination geocodeAddressString

CLGeocoder Only Returning One Placemark

こ雲淡風輕ζ 提交于 2019-11-30 07:08:07
I have a problem with CLGeocoder where when I call geocodeAddressString:withCompletionHandler I only ever get one result back, despite knowing that the inputted string should return more than one value. The class reference even states: In the case of forward-geocoding requests, multiple placemark objects may be returned if the provided information yielded multiple possible locations. However, my placemarks array only ever has one item in it: [geocoderDestination geocodeAddressString:destination completionHandler:^(NSArray *placemarks, NSError *error){ NSLog(@"array count:%i", [placemarks count

Get current city and country from CLGeocoder?

你。 提交于 2019-11-29 23:21:40
I've been all over the internet trying to find out how to get the city and country from CLGeocoder . I can get the longitude and latitude easily but I need the city and country information, and I keep running into deprecated methods and such, any ideas? It basically needs to get the location, then have an NSString for the country, and an NSString for the city, so I can use them to look up more info or put them on labels, etc. You need to revise your terminology a bit - CLGeocoder (and most geocoders) won't give you a 'city' per-se - it uses terms such as 'Administrative Area',

Set address string with reverseGeocodeLocation: and return from method

陌路散爱 提交于 2019-11-29 08:52:31
I'm try to localize a start and end point to an address string, so that I can store it into NSUserDefaults . The problem is that the method continues executing and does not set my variable. NSLog(@"Begin"); __block NSString *returnAddress = @""; [self.geoCoder reverseGeocodeLocation:self.locManager.location completionHandler:^(NSArray *placemarks, NSError *error) { if(error){ NSLog(@"%@", [error localizedDescription]); } CLPlacemark *placemark = [placemarks lastObject]; startAddressString = [NSString stringWithFormat:@"%@ %@\n%@ %@\n%@\n%@", placemark.subThoroughfare, placemark.thoroughfare,

iPhone iOS5 CLGeocoder how to geocode a large (200) set of addresses?

不想你离开。 提交于 2019-11-28 21:59:56
I got a large set of about 200 addresses for which I need to know their latitude and longitude. I've created a method that parses the addresses, and now I'm trying to get coordinates for these addresses using CLGeocoder . My current approach is to create geocoders in parallel and let them do their magic. I noticed that each one of them seems to take a separate thread. (so I saw up to 100 threads at one point). The problem that I'm running into is that at some point (after about 50 addresses), geocodes stop returning any place marks, and the NSLog(@"Address not recognized: *%@*",[htc

Get current city and country from CLGeocoder?

独自空忆成欢 提交于 2019-11-28 20:37:56
问题 I've been all over the internet trying to find out how to get the city and country from CLGeocoder . I can get the longitude and latitude easily but I need the city and country information, and I keep running into deprecated methods and such, any ideas? It basically needs to get the location, then have an NSString for the country, and an NSString for the city, so I can use them to look up more info or put them on labels, etc. 回答1: You need to revise your terminology a bit - CLGeocoder (and

kCLErrorDomain error 2 after geocoding repeatedly with CLGeocoder

时间秒杀一切 提交于 2019-11-28 10:43:21
I have a search bar in my application that the user can type an address into, and it will come up with the geocoded result. The result updates as the user types, according to the following code: - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { ... if (self.geocoder.geocoding) [self.geocoder cancelGeocode]; [self.geocoder geocodeAddressString:searchText completionHandler:^(NSArray *placemarks, NSError *error) { if (error != nil) { NSLog(@"ERROR during geocode: %@", error.description); return; } //update the view }]; } This works for the first few characters the