Jul 2, 2013 Replies: 10 The attached class allows you to convert coordinates between Lat Lon coordinates and UTM coordinates. The conversion is done with WGS84 datum. Note that the class code can handle other datums as well. Usage example: Code: Sub Activity_Create(FirstTime As Boolean) Dim g As Geodesic g.Initialize Dim u As UTM u.UtmXZone = 36 u.X = 500000 u.Y = 3600000 u.NorthHemisphere = True Dim ll As LatLon ll = g.WGS84UTMTOLatLon(u) Log(ll.Lat & "N " & ll.Lon & "E") End Sub There were reports of inaccurate results. I wasn't able to reproduce them. Make sure to test it thoroughly. Attachments Geodesic.bas Geodesic.bas 8.4 KB · Views: 1,737 Last edited: Jul 10, 2016 Click to expand...
The attached class allows you to convert coordinates between Lat Lon coordinates and UTM coordinates. The conversion is done with WGS84 datum. Note that the class code can handle other datums as well. Usage example: Code: Sub Activity_Create(FirstTime As Boolean) Dim g As Geodesic g.Initialize Dim u As UTM u.UtmXZone = 36 u.X = 500000 u.Y = 3600000 u.NorthHemisphere = True Dim ll As LatLon ll = g.WGS84UTMTOLatLon(u) Log(ll.Lat & "N " & ll.Lon & "E") End Sub There were reports of inaccurate results. I wasn't able to reproduce them. Make sure to test it thoroughly.
laviniut Active Member Licensed User Longtime User Jul 18, 2014 #2 Sorry, how to convert GPS coordinates, like in GPS tutorial example from you, to decimal degrees ?
klaus Expert Licensed User Longtime User Jul 18, 2014 #3 The GPS library returns decimal degrees ! If you look in the code of the GPSTutorial project you would see in the GPS_LocationChanged routine that the original location values are converted to minutes ! . Replace this routine: Code: Sub GPS_LocationChanged (Location1 As Location) lblLat.Text = "Lat = " & Location1.ConvertToMinutes(Location1.Latitude) lblLon.Text = "Lon = " & Location1.ConvertToMinutes(Location1.Longitude) lblSpeed.Text = "Speed = " & Location1.Speed End Sub by this one ! Code: Sub GPS_LocationChanged (Location1 As Location) lblLat.Text = "Lat = " & Location1.Latitude lblLon.Text = "Lon = " & Location1.Longitude lblSpeed.Text = "Speed = " & Location1.Speed End Sub You could use NumberFormat to format the output.
The GPS library returns decimal degrees ! If you look in the code of the GPSTutorial project you would see in the GPS_LocationChanged routine that the original location values are converted to minutes ! . Replace this routine: Code: Sub GPS_LocationChanged (Location1 As Location) lblLat.Text = "Lat = " & Location1.ConvertToMinutes(Location1.Latitude) lblLon.Text = "Lon = " & Location1.ConvertToMinutes(Location1.Longitude) lblSpeed.Text = "Speed = " & Location1.Speed End Sub by this one ! Code: Sub GPS_LocationChanged (Location1 As Location) lblLat.Text = "Lat = " & Location1.Latitude lblLon.Text = "Lon = " & Location1.Longitude lblSpeed.Text = "Speed = " & Location1.Speed End Sub You could use NumberFormat to format the output.
laviniut Active Member Licensed User Longtime User Jul 18, 2014 #4 Yes, i see now. Thank you. I was in a hurry and i have not seen that.
A arnold steger Member Licensed User Longtime User Apr 10, 2017 #5 i have a big database whit utm coordinates without utmxzone. example point from database: 733149.983999997 5183855.2929 i want convert in lat/lon. how can find the u.UtmXZone for each point?
i have a big database whit utm coordinates without utmxzone. example point from database: 733149.983999997 5183855.2929 i want convert in lat/lon. how can find the u.UtmXZone for each point?
DaveW Active Member Licensed User Longtime User Apr 12, 2017 #6 You can't. There are 60 zones covering the earth, every one of which will have a valid position 733149.983999997 5183855.2929 - or any other X & Y combination. Assuming these are in Northing Easting order then each zone will have a point with these coordinates about 460Km East or West of the adjacent zone.
You can't. There are 60 zones covering the earth, every one of which will have a valid position 733149.983999997 5183855.2929 - or any other X & Y combination. Assuming these are in Northing Easting order then each zone will have a point with these coordinates about 460Km East or West of the adjacent zone.
Celso Member Licensed User Longtime User Jul 6, 2019 #7 Hi, can you example how to convert ex:-19.868847,-43.965379 to UMC ?
Erel B4X founder Staff member Licensed User Longtime User Jul 7, 2019 #8 Code: Dim geo As Geodesic geo.Initialize Dim ll As LatLon ll.Lat = -19.868847 ll.Lon = -43.965379 Dim utm As UTM = geo.WGS84LatLonToUTM(ll) Log(utm)
Code: Dim geo As Geodesic geo.Initialize Dim ll As LatLon ll.Lat = -19.868847 ll.Lon = -43.965379 Dim utm As UTM = geo.WGS84LatLonToUTM(ll) Log(utm)
J jamesnz Active Member Licensed User Longtime User Jul 19, 2019 #9 where is the geodesic Library? has it been removed , or incorporated elsewhere ? Geodesic.bas appears to be a blank file ?
where is the geodesic Library? has it been removed , or incorporated elsewhere ? Geodesic.bas appears to be a blank file ?
DonManfred Expert Licensed User Longtime User Jul 19, 2019 #10 jamesnz said: Geodesic.bas appears to be a blank file ? Click to expand... No, it is 8kb in size and has 260 lines... Download it again It is not a library btw, it is a class which you need to add to your app.
jamesnz said: Geodesic.bas appears to be a blank file ? Click to expand... No, it is 8kb in size and has 260 lines... Download it again It is not a library btw, it is a class which you need to add to your app.
J jamesnz Active Member Licensed User Longtime User Jul 19, 2019 #11 got it, was trying to open it directly, thanks ( again) Manfred