Skip to content

Swift class to calculate magnetic declination, magnetic field strength, inclination etc. for any point on the earth

License

Notifications You must be signed in to change notification settings

kanchudeep/Geomagnetism-Swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Geomagnetism Swift

Swift class to calculate magnetic declination, magnetic field strength, inclination etc. for any point on the earth.

Usage

// Create instance with only location and without altitude & date
let gm:Geomagnetism = Geomagnetism(longitude: 123.45678, latitude: 76.54321)
print("Declination: \(gm.declination)")

// Create a date for calculation
let dateComponents:DateComponents = DateComponents(year: 2017, month: 7, day: 1)
var date:Date = Calendar.init(identifier: .gregorian).date(from: dateComponents)!
// Update instance with altitude and date apart from location
gm.calculate(longitude: 98.76543, latitude: 12.34567, altitude: 1234, date: date)
print("Declination: \(gm.declination)")

About

Swift class to calculate magnetic declination, magnetic field strength, inclination etc. for any point on the earth

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages