GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others) - Page 2-VBForums
Page 2 of 2 FirstFirst 12
Results 41 to 73 of 73

Thread: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

  1. #41
    Addicted Member
    Join Date
    Jul 2007
    Posts
    130

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Hi
    i have these coordinates N53200,E70300 from a map and this place in saudi arabia

    and i want to convert to it corresponding lat and lon (lat=27 13.0947 lon=49 539406)
    how?
    i try the above code but it gives me wrong value
    thanks in advance.

  2. #42
    New Member
    Join Date
    Apr 2010
    Posts
    3

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    which is many miles to the south of where I want. I want to be able to zoom to google maps based on the user click.maybe something happened when I convert to C#.

  3. #43
    New Member
    Join Date
    May 2010
    Posts
    1

    UTM to decimal degree

    In sample 2 from your first post, how do I return decimal degree?

    Regds
    Inge

  4. #44
    Addicted Member
    Join Date
    Jul 2007
    Posts
    130

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    any idea how to convert those coordinates N53200,E70300
    to degrees? because i don't know what are these coordinates are?
    thanks in advance.

  5. #45

    Thread Starter
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,448

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Please verify all coordinates with this (or any other) online conversion engine: http://www.rcn.montana.edu/resources...ordinates.aspx

    I've verified this class many times with the example one I gave and several others, and it's been extremely accurate. If you don't know what kind of coordinate data you have, then I suggest reviewing your own data and researching various coordinate systems on Google.

    Looking over the code, you should easily find where it generates the decimal values of Latitude and Longitude before converting it to the output strings.

    Finally, no, I don't know what global coordinate system Google Maps uses or if it works/doesn't work with this class. Once again, it's something you'll have to research with Google. Like the title of this post says, this class converts between Lat/Long and various UTM Coordinates such as WGS84. If you don't understand what every word in that last sentence means, then you've got some research to do.

    Converting map coordinates is far-far trickier than most people think. There are a LOT of coordinate/mapping standards out there; some global, some outdated, many local or country-specific. Some are even patch-work which means depending on where you are, the computational data changes (such as NAD27). Know what you're working with before posting please.

    Thanks you.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  6. #46
    New Member
    Join Date
    Aug 2010
    Posts
    1

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Hello Jenner,
    I am new to coordinate conversion, but was googling around and found your class and it is exactly what I need. I am following your examples, using a Lat/Long of 35.97327766/-85.96502471 and trying to convert it to NAD83 UTM (TN Zone 4100). I am getting the values easting: 593312.90865883883 and northing: 3981479.7292554607, but the values I have supplied to me by a flight client for the easting/northing are 1978849.094,596951.126. Any help or expertise you could provide would be greatly appreciated.

    Thank you.
    Last edited by 23michaelj45; Aug 5th, 2010 at 09:47 PM.

  7. #47
    New Member
    Join Date
    Oct 2010
    Posts
    1

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Can this be used to override zones? By that I mean, can I force it to calculate the Easting/Northing in a specific zone?

    Thanks,
    John

  8. #48
    New Member
    Join Date
    Jun 2011
    Posts
    1

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Hello Jenner,

    (I hope you are still paying attention to this thread)

    I am trying to use the class you built in VB in my project. However, I am having problems with coordinates in the southern hemisphere.

    I have created a C# test class based on the Excel spreadsheet from http://www.uwgb.edu/dutchs/UsefulDat...ertUTMNoOZ.HTM . I have put the file on GitHub - it is available on https://github.com/jlundstocholm/Coo...Transformation .

    All coordinates in the Northern hemissphere are calculated correctly, but all coordinates in South fail. As an example, the coordiates

    Northern: 3000000
    Eastern: 430000
    Hemisphere: South
    Zone: 28

    Is supposed (from the spreadsheet as well at the test page on http://www.rcn.montana.edu/resources...&n=3000000&h=S ) to be

    Code:
    Longitude: 15° 42' 22,616" West
    Latitude: 27° 8' 45.503" South
    But your class yields the result

    Code:
    Longitude: {16° 23' 16,314" West
    Latitude: 63° 7' 21,179" South
    I have looked thru the code and as far as I can see, it pretty much mimics the formulas in the spreadsheet.

    Do you have an idea of what I am doing wrong?

    And also: have you thought about putting an Open Source license to your class like Apache, BSD or similar? It would make it easier to reuse in projects.

    Thank you,

    :-)

    /Jesper Lund Stocholm
    Copenhagen, Denmark

  9. #49
    New Member
    Join Date
    Jul 2011
    Posts
    2

    Smile Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Hello Jenner.
    I need to convert Lat/Lon coordinates to MGRS and vice-versa ina VB. Net web application (VS2010).

    Could you help?
    T.I.A.

  10. #50

    Thread Starter
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,448

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    MGRS is based on UTM and isn't too hard to convert between the two. Just Google "MGRS to UTM formula" and you should find something you can use. Thus, you can use this class to convert from Lat/Long to UTM and then from UTM to MGRS and back.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  11. #51
    New Member
    Join Date
    Oct 2011
    Posts
    2

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Quote Originally Posted by jvonbokel View Post
    Can this be used to override zones? By that I mean, can I force it to calculate the Easting/Northing in a specific zone?

    Thanks,
    John
    The GPS.vb was just what I've been looking for. It works great.
    But I also need to "force" zones. In Norway we only use UTM zone 32,33 and 35. We skip 31, 34 and 36.

    Can anyone give me a hint of what to do?

    Thanks.

  12. #52

    Thread Starter
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,448

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    You can probably change the math routine to skip certain zones and calculate to adjacent zones. It sounds like Norway uses a local variant of general purpose UTM. Several countries do apparently, there are dozens and dozens of "local" systems that are anywhere from small tweaks to UTM to complete hybrids with local patch transforms.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  13. #53
    New Member
    Join Date
    Oct 2011
    Posts
    2

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Quote Originally Posted by Jenner View Post
    You can probably change the math routine to skip certain zones and calculate to adjacent zones. It sounds like Norway uses a local variant of general purpose UTM. Several countries do apparently, there are dozens and dozens of "local" systems that are anywhere from small tweaks to UTM to complete hybrids with local patch transforms.
    I could substitue GetZoneCM() with 9 (centermeridian of zone 32). that would probably do the trick. Btw all of southern Norway is in zone 32, although the western part should be in zone 31.

    http://en.wikipedia.org/wiki/File:LA...-UTM-zones.png

    Anyway thnx

  14. #54
    New Member
    Join Date
    Jan 2012
    Posts
    3

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Hi Jenner - I really appreciate the effort you have invested to make this code available and I accept that it is accurate, so I also accept any error is my error but hoping to prevail on your good nature (what a creep, eh)

    OK, although I'm new to this vb .Net lark, I think I have installed the code OK on the grounds that it doesn't crash and it doesn't complain and it does something.

    vb Code:
    1. Dim utm As New GPS.UTM(340374, 366857, 30)
    2.  
    3.         utm.UTMLatitudeHemisphere = GPS.UTMLat.North
    4.         utm.Datum = GPS.UTMDatum.WGS84
    5.  
    6.         txtLatitude = utm.Latitude.ToString
    7.  
    8.         txtLongitude = utm.Longitude.ToString
    9.         MsgBox(txtLatitude & "," & txtLongitude)

    The txtlatitude variable returned is 3 degrees, 4 minutes and 43.550 seconds
    the txtLongitude variable returned is 4 degrees, 11 minutes and 53.319 seconds

    but if I use an external website thus

    http://rcn.montana.edu/resources/too...4&n=366858&h=N

    I get
    Latitude: 3° 19' 4.776" N
    Longitude: 4° 26' 12.338" W

    I don't understand how I have made an error. Can you help?

    A second question, if I may - can the code return Degree Decimal format results?

    Thanks in anticipation

    Tim
    Last edited by gep13; Jan 26th, 2012 at 12:52 AM. Reason: Added Highlight Tags

  15. #55
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,962

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Hello TimHaydnJones,

    Welcome to the forums!

    Just a quick note...

    When you are posting code into the forum, can you please remember to surround it in [code][/code] or [HIGHLIGHT=vb][/highlight] tags? It makes it a lot easier to read. I have done this for you in your above post.

    Gary

  16. #56

    Thread Starter
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,448

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Quote Originally Posted by TimHaydnJones View Post
    Hi Jenner - I really appreciate the effort you have invested to make this code available and I accept that it is accurate, so I also accept any error is my error but hoping to prevail on your good nature (what a creep, eh)

    OK, although I'm new to this vb .Net lark, I think I have installed the code OK on the grounds that it doesn't crash and it doesn't complain and it does something.

    vb Code:
    1. Dim utm As New GPS.UTM(340374, 366857, 30)
    2.  
    3.         utm.UTMLatitudeHemisphere = GPS.UTMLat.North
    4.         utm.Datum = GPS.UTMDatum.WGS84
    5.  
    6.         txtLatitude = utm.Latitude.ToString
    7.  
    8.         txtLongitude = utm.Longitude.ToString
    9.         MsgBox(txtLatitude & "," & txtLongitude)

    The txtlatitude variable returned is 3 degrees, 4 minutes and 43.550 seconds
    the txtLongitude variable returned is 4 degrees, 11 minutes and 53.319 seconds

    but if I use an external website thus

    [url]http://rcn.montana.edu/resources/tools/coordinates.aspx?nav=11&c=UTM&md=83&mdt=NAD83/WGS84&z=30&e=340374&n=366858&h=N

    I get
    Latitude: 3° 19' 4.776" N
    Longitude: 4° 26' 12.338" W

    I don't understand how I have made an error. Can you help?

    A second question, if I may - can the code return Degree Decimal format results?

    Thanks in anticipation

    Tim
    Your Northing and Easting are reversed. In my tool, you use the format:
    GPS.UTM(Northing, Easting, Zone)
    GPS.UTM(340374, 366857, 30)

    but in the web tool, your link shows:
    http://rcn.montana.edu/resources/tools/coordinates.aspx?nav=11&c=UTM&md=83&mdt=NAD83/WGS84&z=30&e=340374&n=366858&h=N

    If you flip the two on the web tool, you'll see you get a result that matches my tool and vice-versa.
    Last edited by Jenner; Jan 27th, 2012 at 11:58 AM.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  17. #57
    New Member
    Join Date
    Jan 2012
    Posts
    3

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    DOH! - do I feel sheepish or what!

    Moving onto my next issue, if I may - Is there a way I can pass in 6x6 digit UK Eastings and Northings, based on the Ordnance Survey National Grid (OSNG)?

    The OSNG coordinates (Eastings) 329636, (Northings) 407288 relate to a lat/long of 53.5575437399072, -3.06531429290771 but convert back to a
    UTM Easting of 495673 and a UTM Northing of 5934298 (WGS84 Zone 30).
    (Reading some documentation from the Ordnance Survey, I guess this is something to do with the fact that the OSNG origin is at Lat 49 degrees North and Long 2 degrees West, which means that my OSNG Northings are too small and (it seems) I can't pass them into your code in their native form)

    So, I understand that I can use your code to translate from the UTM to Lat/Long and vice versa but can I use it to convert my 6x6 OSNG co-ordinate to Lat/Long?

  18. #58

    Thread Starter
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,448

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    As written, I'm afraid not. Every local/country grid has it's own sets of peculiarities that must be programmed around. I mean, it's certainly possible to write a conversion, but I'm afraid I'm not that good at math to undertake such a task.

    Back when I found the formulations and decided to write this class up, I looked into writing up routines to convert into the United States system as well... but researching the problem showed me just how immensely complex that would have been since almost every state in our country has it's own "local grid data" with table-loads of conversions required to stitch it all together into the monstrosity known as NAD83.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  19. #59
    New Member
    Join Date
    Jan 2012
    Posts
    3

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Thanks for a rapid response, Jenner and thanks again for the code.
    Oh, and by the way, if you think your Maths is questionable, you should see mine
    regards

    Tim

  20. #60
    New Member
    Join Date
    Feb 2012
    Posts
    1

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    A word of warning - as you might have gathered from some of the posts in this thread, porting this class to C# using an online converter will screw some things up. My latitude was off by about 10 miles. If I ever get a C# version running, I will edit this post with a link to the code.

  21. #61
    New Member
    Join Date
    Jun 2012
    Posts
    5

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Very nice! I downloaded this for two reasons. The first was to learn how to convert UTM to Lat/Long (and vice versa). The second was as an example of a Class. Being a relative newcomer to the whole OOP thing (though I've had many years of programming experience), I wanted to learn more about it.

    Quick question. Would this class be a good place to put conversion routines for doing the various lat/long formats (DMS.dd, DM.dd, D.dd)?

    Thanks for the code!
    Larry

  22. #62

    Thread Starter
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,448

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Absolutely! Classes are as flexible as you need them to be.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  23. #63
    New Member
    Join Date
    Jun 2012
    Posts
    1

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    We are looking to use this in a research project. Is there a license agreement for this code?

  24. #64

    Thread Starter
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,448

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Nope, freeware as far as I'm concerned. That's why it's posted on here.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  25. #65
    New Member
    Join Date
    Jun 2012
    Posts
    1

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    I'm afraid your class is extremely accurate and useful.

    Also for peeps who be tryin to convert to C#. This is what I did:
    1) Create a VB Library Project.
    2) Add the GPS.vb class
    3) Compile
    4) Start a new C# project
    5) Reference the first VB Library Project directly or through the compiled DLL
    6) There you can use the class as if it were c#


    Anw. Thanks again. You have saved so many lives by posting this code.

  26. #66
    New Member
    Join Date
    Dec 2012
    Posts
    3

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    It seems like a simple question, but i just cant seem to work it out.

    I have Eastings, Northings, Hemisphere and the Zone, I can get the class to work and it outputs Latitudes and Logditudes for me, but they are in DMS, but I really need to get the output in Decimal Long/Lat.

    I know im missing something simple.

    this is the code i use to output the Long/Lat, is there a conversion function?

    Dim utm As New GPS.UTM(Northing, Easting, Zone)
    utm.UTMLatitudeHemisphere = GPS.UTMLat.South

    MyLatitude = utm.Latitude.ToString
    MyLongitude = utm.Longitude.ToString
    i feel like it should be

    MyLatitude = utm.Decimal.Latitude.ToString
    MyLongitude = utm.Decimal.Longitude.ToString
    Or something similar.

    Thanks, Mike

  27. #67
    New Member
    Join Date
    Jun 2012
    Posts
    5

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    To get decimal degrees, it's

    degrees + (minutes/60) + (seconds/3600)

  28. #68
    New Member
    Join Date
    Jun 2012
    Posts
    5

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    To get decimal degrees, it's

    degrees + (minutes/60) + (seconds/3600)

  29. #69
    New Member
    Join Date
    Dec 2012
    Posts
    3

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Quote Originally Posted by lar3ry View Post
    To get decimal degrees, it's

    degrees + (minutes/60) + (seconds/3600)
    I understand the Maths involved, im just unsure of how to implement this. Would i do it in the GPS.vb class or would i do this in my function?

    This is a snippet of my code:

    If reader.HasRows Then
    While reader.Read()
    Northing = reader("Northing")
    Easting = reader("Easting")
    CarNumber = reader("CarNbr")
    Zone = reader("Zone")

    Dim utm As New GPS.UTM(Northing, Easting, Zone)
    utm.UTMLatitudeHemisphere = GPS.UTMLat.South

    MyLatitude = utm.Latitude.ToString
    MyLongitude = utm.Longitude.ToString


    Lats = Left(MyLatitude, Len(MyLatitude) - 6)
    Longs = Left(MyLongitude, Len(MyLongitude) - 5)

    'LongsDblQotPos = InStr(Longs, "&#34")
    'LongsSnglQotPos = InStr(Longs, "'")
    'LongsMin = Mid(Longs, 6, Len(Longs) - 7 - LongsSnglQotPos)
    'LongsSec = Mid(Longs, LongsSnglQotPos + 2, Len(Longs) - (LongsSnglQotPos + 2))

    'LongsDecimal = (((LongsSec / 60) + LongsMin) / 60) + 27


    'LatsDblQotPos = InStr(Lats, "&#34")
    'LatsSnglQotPos = InStr(Lats, "'")
    'LatsMin = Mid(Lats, 5, Len(Lats) - 6 - LatsSnglQotPos)
    'LatsSec = Mid(Lats, LatsSnglQotPos + 2, Len(Lats) - (LatsSnglQotPos + 2))

    'LatsDecimal = CDbl(Val((((LatsSec / 60) + LatsMin) / 60) + 153))

    My.Computer.FileSystem.WriteAllText("C:\TestCopy.txt", "['Car:" & CarNumber & "'," & " -" & Lats & "," & " " & Longs & ", " & index & "]" & Chr(10), True)

    index = index + 1

    End While


    End If
    It reads the values from a DB then converts them from UTM to Lat Long, but my application needs lat longs in decimal format. Im just unsure of how to do that.

  30. #70
    New Member
    Join Date
    Dec 2012
    Posts
    3

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Dismiss my last question... it seems with a little more obvious thinking i worked it out!

    If reader.HasRows Then
    While reader.Read()
    Northing = reader("Northing")
    Easting = reader("Easting")
    CarNumber = reader("CarNbr")
    Zone = reader("Zone")

    Dim utm As New GPS.UTM(Northing, Easting, Zone)
    utm.UTMLatitudeHemisphere = GPS.UTMLat.South

    MyLatitude = utm.Latitude.ToString
    MyLongitude = utm.Longitude.ToString

    LatsDecimal = utm.Latitude.Degrees + (utm.Latitude.Minutes / 60) + (utm.Latitude.Seconds / 3600)
    LongsDecimal = utm.Longitude.Degrees + (utm.Longitude.Minutes / 60) + (utm.Longitude.Seconds / 3600)

    My.Computer.FileSystem.WriteAllText("C:\TestCopy.txt", "['Car:" & CarNumber & "'," & " -" & LatsDecimal & "," & " " & LongsDecimal & ", " & index & "]," & Chr(10), True)

    index = index + 1

    End While


    End If

  31. #71

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    Hi Jenner - I have implemented your code to geolocate aerial images - and the locations are only somewhat close. I have a centroid located at 35.44752324, -119.0344939 and the UTM comes out as 11N 3925110.67478774, 314745.859021866 - this is about 373 and 741 meters off. The Lat/Lon are in WGS84, and I am loading the resulting UTM Arcmap using NAD83_UTM_Zone11 as my projection. . Thanks for your help

  32. #72
    New Member
    Join Date
    Sep 2013
    Location
    Oldsmar, Florida
    Posts
    1

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    I see a lot of posts here requesting decimal Lat/Long output instead of ddd mm' ss.ss".

    So, I added two read only properties to the class. Here is the code with the new parts highlighted:

    Added two local private double variables...
    Code:
        Public Class UTM
            Private Const k0 As Double = 0.9996
    
    
            Private cooLat As New Coordinate(0, CoordinateType.Latitude)
            Private cooLong As New Coordinate(0, CoordinateType.Longitude)
            Private utmDat As UTMDatum = UTMDatum.WGS84
            Private dblNorthing As Double = 0
            Private dblEasting As Double = 0
            Private DecLat As Double = 0.0
            Private DecLong As Double = 0.0
            Private utmL As UTMLat = UTMLat.North
            Private intZone As Int32
    Added two read only properties...

    Code:
    #Region "Properties"
         .
         .
         .
           Public ReadOnly Property DecLatitude() As Double
                Get
                    Return DecLat
                End Get
            End Property
    
            Public ReadOnly Property DecLongitude() As Double
                Get
                    Return DecLong
                End Get
            End Property
         .
         .
         .
    #End Region
    Filled in the private class variables with the values in the UTM to LL conversion ....
    Code:
            Public Sub GetLatLong()
                        .
                        .
                        .
                cooLat = New Coordinate(Convert.ToDecimal(lat), CoordinateType.Latitude)
    
                DecLat = lat
    
                Dim lon As Double = GetZoneCM() - ((lof1 - lof2 + lof3) / Math.Cos(phi1)) * 180 / Math.PI
    
                DecLong = lon
    
                cooLong = New Coordinate(Convert.ToDecimal(lon), CoordinateType.Longitude)
            End Sub
    My question to the forum here is, has anyone seen a class like this, but for U.S. State-Planes <-> LatLong ?

    Korg sends

  33. #73
    New Member
    Join Date
    Apr 2013
    Posts
    1

    Re: GPS Class that maps Lat/Long to UTM Coordinates (WGS84 and others)

    I have been testing the class and it works well ... thank you.
    When I try to convert a UTM coordinate to a Lat/Long coordinate, the latitude is off slightly but the longitude is the same. I am comparing my results to the National Resources Canada website at:
    http://webapp.geod.nrcan.gc.ca/geod/...outils/trx.php.

    The values I am using are:
    N: 5453095.17
    E: 704731.39
    Zone: 13

    The results I get from the class are:
    Lat: 49.196384246396228 (49 11' 46.9833")
    Long: -102.18969397760389 (-102 11' 22.8983")

    but the results from the Geodetic site are:
    Lat: 49 11' 47.17321"
    Long: -102 11' 22.89833"
    From other samples I tested, it appears that the longitude is always the same but the latitude is always off a bit.

    Here is the code I am using:

    Dim utm As New clsGPS.UTM(myNorthing, myEasting, Zone)

    utm.UTMLatitudeHemisphere = clsGPS.UTMLat.North
    lat = utm.Latitude.GetDecimalCoordinate
    lon = utm.Longitude.GetDecimalCoordinate

    Am I missing something?
    Blair

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.