Sub Activity_Create(FirstTime As Boolean)
Dim s As String = "56/1,16973828/65539,393216/1795N "
Dim m As Matcher = Regex.Matcher("(\d+/\d+),(\d+/\d+),(\d+/\d+)", s)
If m.Find Then
Dim lat As Double
lat = FractionToDouble(m.Group(1))
lat = lat + FractionToDouble(m.Group(2)) / 60
lat = lat + FractionToDouble(m.Group(3)) / 3600
Log(lat)
End If
End Sub
Private Sub FractionToDouble(frac As String) As Double
Dim n() As String = Regex.Split("/", frac)
Return n(0) / n(1)
End Sub
getLatLong
Method
Stores the latitude and longitude value in a float array. The first element is the latitude,
and the second element is the longitude.
Returns false if the Exif tags are not available.
Returns : Boolean
getLatLong(output As Float())
Dim LL(2) As Float
exif.getLatLong(LL)
Msgbox("Latitude = " & LL(0), "Latitude")
Camera
SAMSUNG GT-I8190N
GPS Position
60.316476 degrees N, 1.813130 degrees E
Lat: 60.3166727, Lon: 1.9337032
exif.Initialize(File.DirRootExternal & "/app/", "photo.jpg")
exif.setAttribute(exif.TAG_GPS_LATITUDE, lat)
exif.setAttribute(exif.TAG_GPS_LONGITUDE, lon)
exif.setAttribute(exif.TAG_DATETIME, exifDTM)
exif.saveAttributes
See my post #20 in this thread. Looks like you need a string of three rational numbers separated by commas.
exif.setAttribute(exif.TAG_GPS_LATITUDE, "51/1,19/1,46/1")
exif.setAttribute(exif.TAG_GPS_LONGITUDE, "1/1,5/5,5/5")
exif.setAttribute(exif.TAG_GPS_LATITUDE, "51,19,46")
exif.setAttribute(exif.TAG_GPS_LONGITUDE, "1,5,5")
exif.Initialize(File.DirRootExternal & "/app/", "photo.jpg")
Dim output(2) as Float
if exif.getLatLong(output) = True Then
lat = output(0)
lon = output(1)
else
lat = ""
lon = ""
end if