-1

I am finding current latitude and longitude using GPS (without internet).

Now i want to implement reverse geocoding using that latitude and longitude through GPS without internet.

I have successfully implemented reverse geocoding with internet connection.

This is my implemented code:-

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

    NSString * location = ([placemarks count] > 0) ? [[placemarks objectAtIndex:0] locality] : @"Not Found";

    CLPlacemark *placemark = [placemarks objectAtIndex:0];

    NSString *MyAddress = @"";
    MyAddress = [[placemark.addressDictionary objectForKey:@"FormattedAddressLines"] componentsJoinedByString:@", "];
    NSLog(@"address is %@", MyAddress);
}];

I have searched about this but could not find any solution.

How can i do this?

Thanks.

DharaParekh
  • 1,730
  • 1
  • 10
  • 17
AtWork
  • 1,283
  • 1
  • 14
  • 34

2 Answers2

0

You cannot without internet , because this method (reverseGeocodeLocation: completionHandler:) submits the specified location data to the geocoding server asynchronously and returns.

Read the CLGeocoder Class Reference for that CLGeocoder class.

And if you think about it you'll need to have a database in order to get an address , where should it gather that information if not from a remote database.

soryngod
  • 1,827
  • 1
  • 14
  • 13
0

See here: https://stackoverflow.com/a/4419113/2446155

any of the methods mentioned there will work. Keep in mind that openstreetmap.org will only let you download small portions of data at a time. Cloudmate.com lets you download large amounts of data at once, but it will make your application VERY large.

You could also consider downloading and storing all the CLGeocoder Data for a specific area around the user over wifi and then be able to use it without Internet, but I'm not sure if that's possible.

Community
  • 1
  • 1
Andrew
  • 15,357
  • 6
  • 66
  • 101