whatisgithub

What is geomagnetism?

serhii-londar/geomagnetism — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2024-12-17

1SwiftAudience · developerComplexity · 2/5StaleSetup · easy

In one sentence

A Swift toolkit that calculates Earth's magnetic field values, like the difference between true north and magnetic north, for any location, date, and altitude, so apps can correct compass readings.

Mindmap

mindmap
  root((repo))
    What it does
      Magnetic declination
      Field strength
      Field inclination
    Use cases
      Navigation apps
      Hiking trackers
      Marine and aviation
    Tech stack
      Swift
      Single source file
      No dependencies
    Audience
      iOS developers
      Navigation app builders
      Geomagnetic hobbyists

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Correct compass readings in an iOS hiking or outdoor navigation app.

USE CASE 2

Build a marine or aviation navigation tool that converts magnetic north to true north.

USE CASE 3

Research or model geomagnetic field variations for a specific location and date.

What is it built with?

Swift

How does it compare?

serhii-londar/geomagnetismaltuzar/sonicflowcollinkite/steamcontrollerkit
Stars111
LanguageSwiftSwiftSwift
Last pushed2024-12-17
MaintenanceStale
Setup difficultyeasyeasymoderate
Complexity2/52/53/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Can be added as a Swift Package or by dropping a single source file into your project with no external dependencies.

The explanation does not mention a license, so the usage rights for this code are unknown, check the repository for license details before using it.

So what is it?

Geomagnetism is a Swift toolkit that tells you the magnetic field characteristics for any spot on Earth. If you're building an iOS app and need to know things like magnetic declination (the difference between true north and magnetic north), field strength, or inclination at a given location, this library gives you those numbers. You create an object with a longitude and latitude, and optionally an altitude and date, then read off properties like declination. The idea is that compass needles don't point to true north everywhere, the gap varies depending on where you are and shifts slowly over time. This library models those variations so your app can correct for them. The main use case is navigation or mapping apps. If you're displaying a compass, routing hikers, or working on any feature where a user's phone compass needs to align with real-world directions, you need magnetic declination to convert between what the phone's magnetometer sees and actual geographic north. A pilot app, a hiking tracker, or a marine navigation tool would all need this kind of correction. Researchers or hobbyists working with geomagnetic data might also find it useful. The README doesn't go into detail about the underlying model, accuracy, or which magnetic model it uses (such as WMM or IGRF), so you'd need to check the source to understand how precise the calculations are and whether they'll stay valid over time. Installation is straightforward: you can pull it in as a Swift package or just drop the single source file into your project. It's a small, focused tool that does one thing, give you geomagnetic values for a coordinate, without any extra dependencies.

Copy-paste prompts

Prompt 1
Using the Geomagnetism Swift package, write a function that takes a user's current latitude, longitude, and altitude, and returns the magnetic declination so I can correct my app's compass heading.
Prompt 2
Show me how to integrate the Geomagnetism library into an iOS SwiftUI project to display a corrected compass that points to true north instead of magnetic north.
Prompt 3
Using Geomagnetism in Swift, create a helper that fetches the magnetic field strength and inclination for a given coordinate and date, and explain what those values mean for my navigation app.

Frequently asked questions

What is geomagnetism?

A Swift toolkit that calculates Earth's magnetic field values, like the difference between true north and magnetic north, for any location, date, and altitude, so apps can correct compass readings.

What language is geomagnetism written in?

Mainly Swift. The stack also includes Swift.

Is geomagnetism actively maintained?

Stale — no commits in 1-2 years (last push 2024-12-17).

What license does geomagnetism use?

The explanation does not mention a license, so the usage rights for this code are unknown, check the repository for license details before using it.

How hard is geomagnetism to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is geomagnetism for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.