The arrow of a magnetic compass always points north. This feature of a compass needle was noticed in the XII century and began to use a compass for orientation, especially at sea. This device is quite simple. However, if you draw a direct line from point of origin to point of destination and without deviating a single degree follow the plotted course, you will hardly reach your desired destination, especially if the distance was big.
There are two factors that influence your course (compass cours) from the course you drew in a map(true course):
To calculate the compass course by the true course or vice versa, you should set the values of magnetic declination for given location and your compass deviation in the corresponding fields of the calculator. The default values calculate the compass course for the transition from the city of Cadiz (Spain) to Cape St. Vincent (Portugal). For the calculation, I've determined the true course by using this calculator Course angle and the distance between the two points on loxodrome (rhumb line)., where I input the coordinates from Google Maps. The magnetic declination was obtained with a nautical chart of the Western Mediterranean Sea.
Detailed explanations can be found below.
Those who read Jules Verne remember where 15-year-old captain got his ship after Negoro put an axe under the compass binnacle. There are a lot of things on the ship that can affect the magnetic compass. To eliminate this effect, there are deviation charts for each compass that show the compass deviation for various courses. Over time, the deviation may be changed due to the installation of new equipment or the magnetization of the old iron parts, so tables are regularly updated. Using the value of the deviation table, it is possible to bring the compass course to the magnetic course. To do so, the deviation value for this compass course is added to compass course it's deviating east or subtracted if it's deviating west.
Magnetic declination does not depend on the equipment of the vessel, but it depends on its location and also varies with time as the deviation , but more predictably. The magnetic declination is indicated on the map, with the obligatory indication of the measurement year and the average annual change. To switch to the real course, we first obtain the magnetic course and then add the magnetic declination to the east or subtracted the one to the west. Then the average annual change of the magnetic declination is taken into account (it's multiplied by the number of years and then added or subtracted).
The process of switching between compass and the true course is called rhumb correction, and the back process is called rhumb conversion.
There is a simple rule that you can find in English navigation literature which allows you to remember a single word: CadET
It stands for C(ompass), ad(d), E(asterly error), T(rue). The back conversion is similar but instead of adding eastern corrections we subtract them.
В.С. Михайлов, В.Г. Кудрявцев, В.С. Давыдов Навигация и лоция
Tim Bartlett An Introduction to Navigation. RYA.