Hacked-Crew / Magnetic-Declination

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

Magnetic Declination in Expression #8

Open jrlockerby opened 10 months ago

jrlockerby commented 10 months ago

Thanks for adding this (waiting for years on this...) However, I'm not sure I'm executing it correctly. I tested on 2 different locations. One was in SE Oregon (USA) and the other was in the NW part of the Olympic Peninsula. When placing the compass rose at each location, the resulting estimated magnetic declination was correct (compared to NOAA). When using an expression in the Print Composer, the resulting declination was off:

Compass rose result | Expression result

12.617260471625 | -53.4803213820987 15.6308144617189 | -55.2506033505889

jrlockerby commented 8 months ago

Update: I figured out part of the issue. It only provides the correct when using global projections. When using a projection such as UTM Zone 10, it provides incorrect results. I attempted some workarounds, but none have worked so far - in fact, I end up crashing the QGIS application. It would appear that this current revision is not good for topographic land maps. Perhaps the expression syntax should use the plain geographic coordinates instead of the map layer position since its already possible to glean geographic coordinates from the map layer's properties - even if using UTM (a sperate but validated expression).

jrlockerby commented 8 months ago

Another update: My previous comment was only partially correct. Changing projections changed the declination value by a bit, but was still off by several degrees. I can only speculate that the function may be grabbing the incorrect values from the item_properties.

Dret42 commented 7 months ago

Same problem for me:

In main map the magnetic declination is correct but if I use the variable "Magnetic declination" inside Print Composer the value is wrong! I'm using UTM projection too.