GPS Exif Data
Hi,
I've converted latitude and longitude to what I think is the correct format using:
latstring = GetGPSTag(lat)
Sub GetGPSTag(ang As Float) As String
Dim deg As Int
Dim mint As Int
Dim sec As Double
Dim minf As Float
Dim clus As String
deg = ang
minf = (ang-deg)*60
mint = (ang-deg)*60
sec = (minf-mint)*60
clus = deg & "/1," & mint & "/1," & sec & "/1"
Return(clus)
End Sub
This gives latstring="-34/1,-16/1,-43.765etc/1" or something similar, with negative values (Australia).
I then set the latitude attribute in the image file using:
exif.setAttribute(exif.TAG_GPS_LATITUDE,latstring)
However, when I then try to read the exif data using ..
Dim output(2) As Float
exif.Initialize(picdir,picfile)
If exif.getLatLong(output)=True Then
lat = output(0): lng = output(1)
'Show on Map
End If
.. the value I get for the latitude is positive (+34.27etc).
I even tried setting the latitude_ref tag, but to no avail.
If lat>=0 Then exif.setAttribute(exif.TAG_GPS_LATITUDE_REF,"N") Else exif.setAttribute(exif.TAG_GPS_LATITUDE_REF,"S")
What am I not doing correctly?
Hi,
I've converted latitude and longitude to what I think is the correct format using:
latstring = GetGPSTag(lat)
Sub GetGPSTag(ang As Float) As String
Dim deg As Int
Dim mint As Int
Dim sec As Double
Dim minf As Float
Dim clus As String
deg = ang
minf = (ang-deg)*60
mint = (ang-deg)*60
sec = (minf-mint)*60
clus = deg & "/1," & mint & "/1," & sec & "/1"
Return(clus)
End Sub
This gives latstring="-34/1,-16/1,-43.765etc/1" or something similar, with negative values (Australia).
I then set the latitude attribute in the image file using:
exif.setAttribute(exif.TAG_GPS_LATITUDE,latstring)
However, when I then try to read the exif data using ..
Dim output(2) As Float
exif.Initialize(picdir,picfile)
If exif.getLatLong(output)=True Then
lat = output(0): lng = output(1)
'Show on Map
End If
.. the value I get for the latitude is positive (+34.27etc).
I even tried setting the latitude_ref tag, but to no avail.
If lat>=0 Then exif.setAttribute(exif.TAG_GPS_LATITUDE_REF,"N") Else exif.setAttribute(exif.TAG_GPS_LATITUDE_REF,"S")
What am I not doing correctly?
Last edited: