Skip to content

Instantly share code, notes, and snippets.

@marmelroy
Created April 20, 2016 15:58
Show Gist options
  • Save marmelroy/0fee54bfe69bfbfcbbf7057298fca046 to your computer and use it in GitHub Desktop.
Save marmelroy/0fee54bfe69bfbfcbbf7057298fca046 to your computer and use it in GitHub Desktop.
Calculating MKMapCamera's altitude for a distance
let altitude = distance*tan(M_PI*(75.0/180.0))
@AlekseiR
Copy link

AlekseiR commented Jul 6, 2021

@plindberg
Thank you. I've found a related answer on stackoverflow and came up with quite a similar solution.
https://stackoverflow.com/a/21034410/6292624

Wanted to update that on my devices (iOS 13) and simulators (13, 14) max zoom never causes that much delta with target value. In my case minCenterCoordinateDistance ~875 and max zoom value is ~890, so probably mapKitBugAdjustmentFactor should be removed or significantly reduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment