I'm messing about with an app that takes a picture every few meters and uses the UTC time stamp as the picture name. However, the time is not changing when the GPS fix changes.
Here is the section of code that looks after the fix / time change:
And here is the corresponding GPS file which shows Lat, Long, Altitude, Eastings, Northings and PicTime in UTC. This GPS location changes but time (within the picture file name on the far right column) does not change every time. (I've replaced some of the GPS data with XX) There are 19 location changes but only two time changes.
There are 19 location changes but only two time changes.
Is this a GPS issue or my code?
Here is the section of code that looks after the fix / time change:
B4X:
Sub GPS_LocationChanged (Location1 As Location)
Lat1 = Location1.Latitude 'Get Lat
Long1 = Location1.Longitude 'Get GPS Long
Altitude = Location1.Altitude ' Get GPS Alt
GPSTime = Location1.Time ' Get GPS Time
'This next code just converts Lat Long to OSGB coordinates
Dim str As String
Dim digits As Int
Dim sep As String
OSGB.WGS84toOSGB36(Lat1, Long1, Altitude)
str = OSGB.OSGB36toNGR(OSGB.NewLatitude, OSGB.NewLongitude)
digits = 5
sep = " "
ngr = "GridRef: " & str.SubString2(0, 2) & sep & str.SubString2(2, digits + 2)
ngr = ngr & sep & str.SubString2(7, digits + 7) & CRLF
'Removes OSGB if outside UK
If Local = "English (United Kingdom)" Then
East = NumberFormat2(OSGB.Easting, 1, 0, 0, False)
North = NumberFormat2(OSGB.Northing, 1, 0, 0, False)
ngr = ngr & "National Grid: " & East & " " & North & CRLF
Else
East = 0
North = 0
End If
PicTime = dt.Format(GPSTime) ' Give the picture the UTC Date / time as picture name.
Log(PicTime)
camEx.TakePicture ' takes the picture
CSVWriter ' Writes a corresponding CSV file that links GPS to picture
End Sub
And here is the corresponding GPS file which shows Lat, Long, Altitude, Eastings, Northings and PicTime in UTC. This GPS location changes but time (within the picture file name on the far right column) does not change every time. (I've replaced some of the GPS data with XX) There are 19 location changes but only two time changes.
B4X:
Lat Long Alt East North Pic
XX.98134665 XX.2359372 114 XX2979 XX7177 2015-12-17T15:19:10.592+0000
XX.98120744 XX.23652013 78 XX2942 XX7163 2015-12-17T15:19:10.592+0000
XX.98110049 XX.23642104 78 XX2948 XX7151 2015-12-17T15:19:10.592+0000
XX.98106336 XX.23611363 66 XX29XX XX7146 2015-12-17T15:19:10.592+0000
XX.98101XX8 XX.235951XX 85 XX2977 XX7141 2015-12-17T15:19:10.592+0000
XX.98114161 XX.23659628 68 XX2937 XX71XX 2015-12-17T15:19:10.592+0000
XX.98105197 XX.2363XX43 69 XX2952 XX7145 2015-12-17T15:19:10.592+0000
XX.98115443 XX.23XX1069 72 XX2930 XX7157 2015-12-17T15:19:10.592+0000
XX.98112162 XX.236860XX 63 XX2921 XX7153 2015-12-17T15:19:10.592+0000
XX.98108XX4 XX.23702562 68 XX2910 XX7150 2015-12-17T15:19:10.592+0000
XX.98108413 XX.23722216 72 XX2898 XX7150 2015-12-17T15:19:10.592+0000
XX.98111207 XX.23738210 73 XX2888 XX7153 2015-12-17T15:19:10.592+0000
XX.98113348 XX.23754269 69 XX2878 XX7167 2015-12-17T15:19:10.592+0000
XX.98111934 XX.23771388 69 XX28XX XX7154 2015-12-17T15:19:10.592+0000
XX.98110227 XX.23787885 69 XX2857 XX7152 2015-12-17T15:21:21.664+0000
XX.98105112 XX.23805107 69 XX2846 XX7147 2015-12-17T15:21:21.664+0000
XX.98099344 XX.23818972 69 XX2837 XX7141 2015-12-17T15:21:21.664+0000
XX.98091026 XX.23827197 66 XX2867 XX7131 2015-12-17T15:21:21.664+0000
XX.98082791 XX.23834703 68 XX2827 XX7122 2015-12-17T15:21:21.664+0000
There are 19 location changes but only two time changes.
Is this a GPS issue or my code?