It's useful to be able to display a map's magnetic declination alongside the map itself on the layout.
This code creates a function that can be used in the Expression editor to retrieve the center-point and crs of a given map within a Print Layout, and return a double representing the magnetic declination at that point.
This can then be used in a text area or similar on a print layout to display that declination.
For example:
The item text for the right-hand text area above is defined as:
Magnetic
North
Declination:
[% format_number(abs(layout_map_mag_dec(item_variables('Map 1'))), 2) %]º
Thank you very much, I apologize for my silence, I am not very active on the plugin lately. I will update the version on the QGIS repo as soon as possible, obviously with proper citations.
It's useful to be able to display a map's magnetic declination alongside the map itself on the layout.
This code creates a function that can be used in the Expression editor to retrieve the center-point and crs of a given map within a Print Layout, and return a double representing the magnetic declination at that point.
This can then be used in a text area or similar on a print layout to display that declination.
For example:
The item text for the right-hand text area above is defined as: