0

I am trying to find location of places with business names. I think I should use Google Place API as CLGeocoder cannot locate place with name.

So I looked at the Google Place API and got little confused about the part of location field.

I think I am supposed to enter location and radius and optionally name to search.

And I am not sure what location I should enter to find the place when I don't know the location. What I want is location searched from name.

Then, should I use CLGeocoder to find out approximate location and give really huge radius with that location to Google Place API?

For example, If I want to find a certain hotel in LA, then, should I use CLGeocoder to find out the approximate location and then feed that value to Google Place API?

Or is there any other options?

Thank you very much for your help

iYoung
  • 3,596
  • 3
  • 32
  • 59
in His Steps
  • 3,075
  • 6
  • 30
  • 38
  • You mentioned of "confused about the part of location field", which google place API call do you refer to? – Joe Smith Nov 25 '15 at 19:05

1 Answers1

0

Your approche is good - in one of my applications you can enter an address and after entering the address I use the CLGeoCoder to get the placemarks with the coordinates.

CLGeocoder *geoCoder = [[CLGeocoder alloc] init];
[geoCoder geocodeAddressString:addressString completionHandler:^(NSArray *placemarks, NSError *error) {

    if (placemarks && placemarks.count>0) 
    {
        if(placemarks.count==1)
        {
            MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([[[placemarks objectAtIndex:0] location] coordinate], 1000, 1000);

            [mapView setRegion:region animated:YES];
            [mapView regionThatFits:region];
        }
   }

THe placemark has the property coordinate which you can use for the google places API

Lars
  • 512
  • 1
  • 3
  • 13
  • When given my address string it showing error : Error Domain=kCLErrorDomain Code=8 "The operation couldn’t be completed. (kCLErrorDomain error 8.)" – Vineesh TP Jul 03 '14 at 15:14