Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Edit4: 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 attempt to close this question out in two days when I can mark my answer.


let me preface this by saying I am by no means a GIS expert.

I need to overlay a png image over a Google map. Looking at the v3 api reference, the best way to do this is to use a GroundOverlay, which takes a lat,lng bounds.

I am given one UTM NAD83 coordinate - the NW corner.

I've found UTM to lat,long conversion algorithms online, but they don't even appear to be very accurate. The lat,lng bounds object in the Google API takes two lat,lng points - NE and SW. (Edit: I found a decent way to get the NE and SW points based on the NW point and the size of the image and the provided meters/pixel, so it appears my only problem is the accuracy of the conversion, if you would like to see the solution I used to get the NE,SW points, look here) (Edit2: I'm using .NET and just found Proj.Net; currently looking for good examples for using it).

Edit3, the current problem: I am having issues converting the UTM to lat and long. A solution I found here 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:

long: 6.1627096689832594

lat: 30.602349476368449

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?

I'd prefer to stay away from third party software and just find an algorithm to help me accurately overlay the image with the data I'm given, an example of which I've included below:

2.627469
0.000000
0.000000
-2.627469
686029.702258
3581213.621173
UTM
NAD83
15

First row is meters/pixel

Any help you may be able to provide is certainly appreciated.

share|improve this question
    
Which UTM Zone are you currently using? –  Mapperz Feb 22 '12 at 14:55
    
I'm assuming you mean the longitude zone number? 15. I have figured out my problem though - thank you! –  lostWithAMap Feb 22 '12 at 15:36
    
Hi @lostWithAMap I think it might be a little clearer if you put your solution as an answer to your question, and then mark that as the answer. –  djq Feb 22 '12 at 15:58
    
@celenius - Because I am a new user, I cannot answer my own question for another hour, and then I won't be able to mark it as the answer for another two days. I'll try to remember though. –  lostWithAMap Feb 22 '12 at 16:04
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.