Hacked-Crew / Magnetic-Declination

QGIS plugin
GNU General Public License v2.0
5 stars 8 forks source link

Add expression function for using MagDec within Layouts #6

Closed mattcen closed 7 months ago

mattcen commented 10 months ago

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:

image

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) %]º
Hacked-Crew commented 7 months ago

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.