Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLGeocoder Only Returning One Placemark

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];}

Thank you for any help.


I have used strings such as "Piccadilly, UK", "Union Street, UK" which have only returned one result. Now that I think about it, putting UK on the end might be the contributing factor.

like image 398
prince Avatar asked Jul 05 '12 12:07

prince


1 Answers

I dont know about CLGeocoder but if your requirement is a location search another way is to use google location search url http://maps.google.com/maps/geo?q=london which returns a json containing the matched location information.

like image 55
Ab'initio Avatar answered Sep 21 '22 14:09

Ab'initio