| Maptitude GISDK Help |
Gets a reading from a GPS device.
GetGPSInfo()
In case of a transient error (e.g., a timeout when reading from a GPS device), a one-element array is returned, containing a string describing the error. Otherwise, an array of eleven elements is returned, describing the current GPS reading. If particular information is missing, that field is null, otherwise the elements are:
| Element | Type | Contents |
|---|---|---|
| 1 | Integer | Longitude (in millionths of degrees) |
| 2 | Integer | Latitude (in millionths of degrees) |
| 3 | String | Time in the form HH:MM:SS.uuu (hours, minutes, seconds and milliseconds) |
| 4 | String | Date (DD/MM/YY) |
| 5 | Real | Course in degrees true north |
| 6 | Real | Speed (over ground) in miles per hour |
| 7 | Real | Altitude in feet |
| 8 | Real | Course in degrees magnetic north |
| 9 | String | Text describing the status of the device |
| 10 | Real | Horizontal dilution of precision |
| 11 | String | Text describing the status of the device |
A GPS device must be initialized with StartGPS().
The data from the device must be in the NMEA 0183 format.
If only a partial reading is obtained, some of the fields may be null. Some GPS receivers never provide some of the information in this list; e.g., some devices use only degrees true north, others give magnetic north, and a few give both.
A typical receiver only sends data once per second, so frequent readings result in transient timeout errors.
// Most common settings
options = {{"Read From", "\\\\.\\COM1"}, {"Baud Rate", 4800},
{"Data Bits", 8},{"Stop Bits", 1}, {"Parity", "None"}}
StartGPS("Serial Port", options)
dim pos[10]
for i=1 to 10 do
gps_data = GetGPSInfo()
if gps_data.length = 1 then
ShowMessage("An error while reading: " + gps_data[1])
else if gps_data[1] <> null && gps_data[2] <> null then
// Store the location as a coordinate
pos[i] = Coord(gps_data[1], gps_data[2])
end // for
StopGPS()
| Error Type | Meaning |
|---|---|
| Error | No GPS device has been initialized, or a fatal error occurred while reading from the device |
| EndOfFile | Reached the end of the playback file (not applicable when reading from serial ports) |
| Function | Summary |
|---|---|
| StartGPS() | Initializes reading from a GPS device |
| StopGPS() | Closes a GPS device |
| ©2025 Caliper Corporation | www.caliper.com |