# Precision Ag and UTM declination

I've written an open source Precision Agriculture application called AgOpenGPS that does everything from auto steer, to mapping, implement and section turn on/off, auto headland turns and more. It's used by farmers all over the world and everything is documented and free - a rarity in Ag. In ag we mainly use mapping in the area of a quarter section so lat/lon from the GPS is converted to UTM and the grid in meters is then used as basic cartesian coords for most everything.

One challenge I am having is if not farming right on the central meridian of course, the UTM grid declination at the zone borders causes a problem since driving straight north on the grid road should show 0, yet shows of course the error of a couple degrees. Heading can be determined by fixes of the grid, by VTG heading from GPS etc, however the two are only the same at the central meridian. If using a dual antenna for generating a stable heading, the auto steer will not work as the error is too great as the GPS heading vs the grid heading are a couple degrees off. Noticed the problem when AgOpen was being used alongside Trimble, Raven, Hemisphere etc. Years ago mfrs showed different headings, but since then they all aligned.

What I have done is calculated the Convergence angle using atan(sin(latitude)*tan(longitude- zone_north_meridian)). When opening or starting a new field, I take the integer of the northing and easting, store it, then any new fixes coming in are subtracted from those to end up with a manageable value to plot using openGL as a graphic display. (OpenGL does not like large numbers). So effectively this becomes my origin.

At this point i do a rotation matrix of every new incoming point based on the convergence angle and rotate that new fix and record its value as such. This does work, anywhere across the zone north is always north, going north on a grid road is north, the field edges line up with grid.

My question is,: Am I doing this correctly? To create field boundaries etc in Google Earth and import them, I do the same thing, rotate the imported points etc. Going back to google earth, I unwind them again. The major GPS manufacturers, systems costing \$15 to 20k, do have it figured out, I am just wondering if I am going about it correctly.

• Welcome to GIS SE. As a new user, please be sure to take the tour to learn about the site's focused Q&A format. Then edit your question to focus on a single question and highlight where you are having trouble so that others may help you. – Andy Oct 28 '18 at 14:21
• Are all these transformations (rotations, unwinding, etc) done automatically in your code? When you export from your program to Google Earth, do you have misalignment issues? Does your program plot the points/trails/etc. where they should be? – FSimardGIS Oct 28 '18 at 21:59
• Yes, it will be done in code, no operator intervention required. Each field stores the base easting northing as well as the convergence angle when saved. When a new field is made, the convergence angle is determined for it and used from field data when opened again. I am most curious if there is another way to align the grid to current meridian, or is rotating the grid (incoming points) the only real solution. – Briantee Oct 28 '18 at 23:27
• Well you could always create a custom modified Transverse Mercator projection having its central meridian crossing the area in question, or use a different map projection altogether that would preserve azimuths better, but if your code currently works as expected and the accuracy of your program is sufficient for you and your users, then I don't see a problem here. – FSimardGIS Oct 29 '18 at 0:51