title: How to find the nearest 100 meters latitude and longitude depending upon the current location in objective c, Iphone
body: <p>How to find the nearest 100 meters latitude and longitude depending upon the current location, i have created a database in SQLITE3 which consists of set of latitudes and longitudes and corresponding there location name. Depending upon the current location i want to fetch the nearest 100 meters latitude and longitude in objective C,
  I am using the following code to get the Current location,</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
      databaseName = @"searchdata.sql";
  
      NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentDir = [documentPaths objectAtIndex:0];
      databasePath = [documentDir stringByAppendingPathComponent:databaseName];
  
      [self checkAndCreateDatabase];
      [self readDataFromDatabase];
      // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
      // self.navigationItem.rightBarButtonItem = self.editButtonItem;
  
      locationManager = [[CLLocationManager alloc] init];
      locationManager.delegate = self;
      locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
      locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
      [locationManager startUpdatingLocation];
  
  }
  
  - (void)locationManager:(CLLocationManager *)manager
      didUpdateToLocation:(CLLocation *)newLocation
             fromLocation:(CLLocation *)oldLocation
  {
      int degrees = newLocation.coordinate.latitude;
      double decimal = fabs(newLocation.coordinate.latitude - degrees);
      int minutes = decimal * 60;
      double seconds = decimal * 3600 - minutes * 60;
      NSString *lat = [NSString stringWithFormat:@"%d° %d' %1.4f\"", 
                       degrees, minutes, seconds];
      NSLog(@" Current Latitude : %@",lat);
      //latLabel.text = lat;
      degrees = newLocation.coordinate.longitude;
      decimal = fabs(newLocation.coordinate.longitude - degrees);
      minutes = decimal * 60;
      seconds = decimal * 3600 - minutes * 60;
      NSString *longt = [NSString stringWithFormat:@"%d° %d' %1.4f\"", 
                         degrees, minutes, seconds];
      NSLog(@" Current Longitude : %@",longt);
      //longLabel.text = longt;
  }
  </code></pre>
  
  <p>so how to fetch or how to calculate the surrounding 100 meters latitudes and longitudes and display it.</p>
  
  <p>Thanks for the help I am using the following formula </p>
  
  <pre><code>     -(double)kilometresBetweenPlace1:(CLLocationCoordinate2D) place1 andPlace2:(CLLocationCoordinate2D) place2 {
  
      double dlon = convertToRadians([pLong intValue] - [longt intValue]);
      double dlat = convertToRadians([pLat intValue] - [lat intValue]);
  
      double a = ( pow(sin(dlat / 2), 2) + cos(convertToRadians([lat intValue]))) * cos(convertToRadians([pLat intValue])) * pow(sin(dlon / 2), 2);
      double angle = 2 * asin(sqrt(a));
        return angle * RADIO;
  }
  </code></pre>
  
  <p>and getting the following output 8505.369547 on return, i am just confused what is the value i am getting actually.</p>