Kyler, here is the UTM conversion i use. Works to the millimeter - even to convert back. If you want the conversion back, i can post that too. Its written in C# but can easily be changed to whatever language. //private double pi = 3.141592653589793238462643383279502884197169399375; private double sm_a = 6378137.0; private double sm_b = 6356752.314; private double UTMScaleFactor = 0.9996; //private double UTMScaleFactor2 = 1.0004001600640256102440976390556; public void DecDeg2UTM() { zone = Math.Floor((longitude + 180.0) * 0.16666666666666666666666666666667) + 1; GeoUTMConverterXY(latitude * 0.01745329251994329576923690766743, longitude * 0.01745329251994329576923690766743); } // return (degrees * 0.01745329251994329576923690766743); private double ArcLengthOfMeridian(double phi) { double alpha, beta, gamma, delta, epsilon, n; double result; n = (sm_a - sm_b) / (sm_a + sm_b); alpha = ((sm_a + sm_b) / 2.0) * (1.0 + (Math.Pow(n, 2.0) / 4.0) + (Math.Pow(n, 4.0) / 64.0)); beta = (-3.0 * n / 2.0) + (9.0 * Math.Pow(n, 3.0) / 16.0) + (-3.0 * Math.Pow(n, 5.0) / 32.0); gamma = (15.0 * Math.Pow(n, 2.0) / 16.0) + (-15.0 * Math.Pow(n, 4.0) / 32.0); delta = (-35.0 * Math.Pow(n, 3.0) / 48.0) + (105.0 * Math.Pow(n, 5.0) / 256.0); epsilon = (315.0 * Math.Pow(n, 4.0) / 512.0); result = alpha * (phi + (beta * Math.Sin(2.0 * phi)) + (gamma * Math.Sin(4.0 * phi)) + (delta * Math.Sin(6.0 * phi)) + (epsilon * Math.Sin(8.0 * phi))); return result; } private double UTMCentralMeridian(double zone) { return ((-183.0 + (zone * 6.0)) * 0.01745329251994329576923690766743); } private double[] MapLatLonToXY(double phi, double lambda, double lambda0) { double[] xy = new double[2]; double N, nu2, ep2, t, t2, l; double l3coef, l4coef, l5coef, l6coef, l7coef, l8coef; double tmp; ep2 = (Math.Pow(sm_a, 2.0) - Math.Pow(sm_b, 2.0)) / Math.Pow(sm_b, 2.0); nu2 = ep2 * Math.Pow(Math.Cos(phi), 2.0); N = Math.Pow(sm_a, 2.0) / (sm_b * Math.Sqrt(1 + nu2)); t = Math.Tan(phi); t2 = t * t; tmp = (t2 * t2 * t2) - Math.Pow(t, 6.0); l = lambda - lambda0; l3coef = 1.0 - t2 + nu2; l4coef = 5.0 - t2 + 9 * nu2 + 4.0 * (nu2 * nu2); l5coef = 5.0 - 18.0 * t2 + (t2 * t2) + 14.0 * nu2 - 58.0 * t2 * nu2; l6coef = 61.0 - 58.0 * t2 + (t2 * t2) + 270.0 * nu2 - 330.0 * t2 * nu2; l7coef = 61.0 - 479.0 * t2 + 179.0 * (t2 * t2) - (t2 * t2 * t2); l8coef = 1385.0 - 3111.0 * t2 + 543.0 * (t2 * t2) - (t2 * t2 * t2); /* Calculate easting (x) */ xy[0] = N * Math.Cos(phi) * l + (N / 6.0 * Math.Pow(Math.Cos(phi), 3.0) * l3coef * Math.Pow(l, 3.0)) + (N / 120.0 * Math.Pow(Math.Cos(phi), 5.0) * l5coef * Math.Pow(l, 5.0)) + (N / 5040.0 * Math.Pow(Math.Cos(phi), 7.0) * l7coef * Math.Pow(l, 7.0)); /* Calculate northing (y) */ xy[1] = ArcLengthOfMeridian(phi) + (t / 2.0 * N * Math.Pow(Math.Cos(phi), 2.0) * Math.Pow(l, 2.0)) + (t / 24.0 * N * Math.Pow(Math.Cos(phi), 4.0) * l4coef * Math.Pow(l, 4.0)) + (t / 720.0 * N * Math.Pow(Math.Cos(phi), 6.0) * l6coef * Math.Pow(l, 6.0)) + (t / 40320.0 * N * Math.Pow(Math.Cos(phi), 8.0) * l8coef * Math.Pow(l, 8.0)); return xy; } private void GeoUTMConverterXY(double lat, double lon) { double[] xy = MapLatLonToXY(lat, lon, (-183.0 + (zone * 6.0)) * 0.01745329251994329576923690766743); xy[0] = xy[0] * UTMScaleFactor + 500000.0; xy[1] = xy[1] * UTMScaleFactor; if (xy[1] < 0.0) xy[1] = xy[1] + 10000000.0; //keep a copy of actual easting and northings actualEasting = xy[0]; actualNorthing = xy[1]; } --- [Visit Topic](https://discourse.ros.org/t/tractobots-my-attempts-at-field-robots/1486/19) or reply to this email to respond. If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates. ______________________________________________________________________________ ros-users mailing list ros-users@lists.ros.org http://lists.ros.org/mailman/listinfo/ros-users Unsubscribe: