![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Tutorials Basic4ppc tutorials |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
This is the second part of the GPS tutorial.
The first part could be found here: GPS application - Part I In this part we will discuss how to convert the coordinates between Lat/Lon and UTM formats and between different datums. The coordinates which are received from GPS devices are in Lat/Lon format. While this format is useful for aviation and large scale maps, it is less useful for smaller scale maps. The complete world is divided into 60 zones (each zone covers 6 degrees longitude). In each zone a UTM grid is defined. As long as the interest area is in one zone it is usually easier to work with UTM. Most topographic maps only have a UTM grid. One of the benefits of UTM is that the coordinates are measured in meters unlike Lat / Lon coordinates which are measured in degrees. So calculations of distance and bearing with UTM coordinates are much easier (assuming that both coordinates are in the same zone). To make things harder, there are many datums available and each datum represents a slightly different measurement of the earth surface. Most GPS devices and most modern maps use the WGS84 datum. Using the Converter (found in the GPS library), we can make the required conversions easily. We will now add UTM coordinates to our GPS program. First choose Tools - Add Object - Converter, and name it Converter. The most useful method of Converter (with the longest name) is: WGS84LatLonToUTM. This method receives Lat/Lon coordinates (in their decimal format) in WGS84 datum and returns UTM coordinates in the same datum. The return value is a structure (or an array) with 4 fields: XZone, X, YZone (ASCII value), Y. We will declare such a structure in Sub Globals, and name it UTM: Code:
Sub Globals
port = 8
baudrate = 9600
counter = 0
Dim Type (Xzone,X,Yzone,Y) UTM 'The order is important!
End Sub
Remember that when you need to reference a complete array or structure you should add '()' after its name. Code:
If GPS1.DecimalLatitude <> 0 OR GPS1.DecimalLongitude<>0 Then
UTM() = converter.WGS84LatLonToUTM(GPS1.DecimalLatitude,GPS1.DecimalLongitude)
lstData.Add("UTM Zone: " & UTM.Xzone & Chr(UTM.Yzone))
lstData.Add("UTM: " & Round(UTM.X) & " " & Round(UTM.Y))
End If
The Yzone is an ASCII value, so we use Chr to show the relevant letter. ![]() * The Yzone isn't displayed in this image. Now for the other methods of Converter: ChangeDatum - Converts Lat/Lon coordinates between two datums. LatLonToUTM / UTMToLatLon - Converts between the two formats using a specific datum. WGS84UTMToLatLon - Converts between the two formats using the WGS84 datum. See the GPS help for more information and examples of using these methods. |
|
|||
|
hi Erel,
A time ago I ask the question what will I use, UTM or LAT-LON... the replys I get are very good: if you do not CROSS the UTM border, use UTM... But that is something you never now... do you cross the UTM border? So I decide to use for all time the LAT_LON data, and with much more calculation time , I am definatly happy with it, espacialy in B4PPC with his automatic data convertions... If you cross the border in UTM, and you must do calculating time for that fact, I think you lose as much time as in calculating with LAT-LON data. The results of my calculations are also meters at the end, so I get the same results, and I can ashure you: it works very good... So, thinks well before you decide... Put Claude Belgium Last edited by Put Claude : 11-28-2007 at 05:14 PM. Reason: forgot something |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| GPS application - Part I | Erel | Tutorials | 4 | 02-13-2008 06:39 AM |
| Minimize Application | akr | Questions & Help Needed | 4 | 10-18-2007 07:51 PM |
| My first application | Erel | Tutorials | 8 | 10-16-2007 01:00 PM |
| execute , run , another application | giannimaione | Questions & Help Needed | 3 | 05-04-2007 09:04 PM |
| DB Application | scott93727 | Share Your Creations | 0 | 05-02-2007 05:24 AM |