Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Enforce a minimum span of 1 (nautical) mile of longitude, given the center latitude of the region
- // This could very well blow up if you get too close to either pole
- - (MKCoordinateSpan)enforceMinimumSpan:(MKCoordinateRegion)region
- {
- MKCoordinateSpan newSpan = region.span;
- CLLocationDegrees radians = region.center.latitude * M_PI / 180.0;
- CLLocationDegrees minSpan = (1 / (69.11 * cos(radians)));
- newSpan.longitudeDelta = MAX(newSpan.longitudeDelta, minSpan);
- return newSpan;
- }
Add Comment
Please, Sign In to add comment