Guest User

Untitled

a guest
Jul 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Enforce a minimum span of 1 (nautical) mile of longitude, given the center latitude of the region
  2. // This could very well blow up if you get too close to either pole
  3. - (MKCoordinateSpan)enforceMinimumSpan:(MKCoordinateRegion)region
  4. {
  5.     MKCoordinateSpan    newSpan = region.span;
  6.     CLLocationDegrees   radians = region.center.latitude * M_PI / 180.0;
  7.     CLLocationDegrees   minSpan = (1 / (69.11 * cos(radians)));
  8.  
  9.     newSpan.longitudeDelta = MAX(newSpan.longitudeDelta, minSpan);
  10.  
  11.     return newSpan;
  12. }
Add Comment
Please, Sign In to add comment