Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Extra Precision - Numeric Coordinate Data from GPS


simon Jul 10, 2017 04:13 AM

Hi, 

I understand that the IEEE4 format has inherent limits to the precision it can support - generally 7 significant figures.

The issue that I have is that I wish to log GPS data in the format of whole degrees with decimal parts of degrees.

For example 13.5 would be 13 degrees and 30 minutes (North) for latitude.

This is OK as I always get at least 5 decimal places for latitude, which is sufficient to notice if the GPS receiver (mounted on a buoy) is moving significantly.

But, for longitude I have more problems. the location is off the coast of Australia, where the longitude values are greater than 100, so I lose one significant figure from the right hand side of the decimal point. This leads to position resolution that is far too coarse for my needs.

I could store the data as a string, however the downstream process being used to display the position of the buoy can only handle floating point values at the moment. 

I'm using a CR1000 and I've played around with AddPrecise and MovePrecise to try to get better resolution, but there doesn't seem to be a way to carry that resolution through to the data table.

Test code below - this allows manual entry of Lat_deg, Lat_min and Long_deg and Long_min values, then performs some calculations to try different leves of precision and logs the results.

Any advice would be welcome - even if it is to confirm what I believe - that it can't  be done.

Const ScanRate = 1

Public Go As Boolean
Public latitude_deg
Public latitude_min

Public Latitude_lo
Public Latitude_hi
Public Latitude_str
Public Lat_min_hi
Public temp_lat As String *20

Public longitude_deg
Public longitude_min
Public Longitude_lo
Public Longitude_hi
Public Longitude_str
Public Long_min_hi
Public temp_long As String *20

DataTable (GPS_Data,True,2880)
Sample (1,Latitude_lo,IEEE4)
Sample (1,Latitude_hi,IEEE4)
Sample (1,Latitude_str,String)
Sample (1,temp_lat,IEEE4)
Sample (1,Longitude_lo,IEEE4)
Sample (1,Longitude_hi,IEEE4)
Sample (1,Longitude_str,String)
Sample (1,temp_long,IEEE4)
EndTable

Sub GPS_Calc
If latitude_min <> NAN AND latitude_deg <> NAN Then
temp_lat = FormatFloat ((latitude_min/60),"%g")
Latitude_str = FormatFloat(latitude_deg,"%1.0f") & "." & Right(temp_lat,Len(temp_lat)-2)
Latitude_lo = latitude_deg + (latitude_min/60)
MovePrecise(Lat_min_hi,(latitude_min/60))
MovePrecise(Latitude_hi,latitude_deg)
AddPrecise(Latitude_hi,Lat_min_hi)
EndIf
If longitude_min <> NAN AND longitude_deg <> NAN Then
temp_long = FormatFloat ((longitude_min/60),"%g")
Longitude_str = FormatFloat(longitude_deg,"%1.0f") & "." & Right(temp_long,Len(temp_long)-2)
Longitude_lo = longitude_deg + (longitude_min/60)
MovePrecise(Long_min_hi,(longitude_min/60))
MovePrecise(Longitude_hi,longitude_deg)
AddPrecise(Longitude_hi,Long_min_hi)
EndIf
CallTable GPS_Data
EndSub

BeginProg
Scan (ScanRate,Sec,0,0)
If Go = True Then
Call GPS_Calc
Go = False
EndIf
NextScan
EndProg


JDavis Jul 10, 2017 05:27 PM

AddPrecise and MovePrecise are used to avoid rounding errors in math. The end result will still be stored and transmitted in IEEE4.

A CR6 supports 64bit floating point.

If you just need to know if the buoy is drifting significantly, the ground speed from the GPS could be helpful. It is the difference between location messages.


pokeeffe Jul 12, 2017 05:39 PM
Log in or register to post/reply in the forum.