dtryan
dtryan

Reputation: 557

Problems converting NAD83 UTM to lat and long

Edit So the solution I posted from Jenner at VBforums was, obviously, in VB, and I used an online converter to port it to C#. Something was lost in translations, and that's why it was 10 miles off.

I'm guessing I am just misunderstanding what the algorithms at the Proj.Net discussion boards are for and that's why they weren't doing what I wanted them to.

I will close this question out in two days when I can mark my answer unless someone provides something awesome.


I am having issues converting UTM to lat and long. As an example, I have the following NAD83 UTM coordinate:

Easting: 686029.702258

Northing: 3581213.621173

zone: 15

A solution I found on vbforums a while ago gives me a point about 10 miles south of where I would expect it. A simple mathematical solution I found here, is giving me unexpected results.

double[] inverseMercator (double x, double y) {
     double lon = (x / 20037508.34) * 180;
     double lat = (y / 20037508.34) * 180;

     lat = 180/Math.PI * (2 * Math.Atan(Math.Exp(lat * Math.PI / 180)) - Math.PI / 2);
     return new double[] {lon, lat};
}
double[] toPoint = inverseMercator (686029.702258, 3581213.621173);

I get the following result:

lat: 30.602349476368449

long: 6.1627096689832594

I get similar results using the Proj.Net solution provided by D_Guidi in the same thread.

Using an online converter, I was able to get something closer to what I am expecting:

lat: 32.35238307052292

long: -91.0230710652583

Can anyone shed any light on what I am doing wrong?

Edit - would prefer .NET solutions or something that would be easily convertible

Related thread

Upvotes: 0

Views: 2435

Answers (2)

dtryan
dtryan

Reputation: 557

So the solution I posted from Jenner at VBforums was, obviously, in VB, and I used an online converter to port it to C#. Something was lost in translations, and that's why it was 10 miles off.

I'm guessing I am just misunderstanding what the algorithms at the Proj.Net discussion boards are for and that's why they weren't doing what I wanted them to.

Upvotes: 0

James Andres
James Andres

Reputation: 1532

Have you tried the cs2cs binary contained in "proj" (projection, http://trac.osgeo.org/proj/)? I believe that will do an accurate job converting UTM to easting/northing and lat/lon. The trouble is simple math formula do not accurately, enough, account for the shape of the earth.

Upvotes: 1

Related Questions