Obtain geolocation data from Image (1 Viewer)

kevlray

Registered User.
Local time
Yesterday, 18:35
Joined
Apr 5, 2010
Messages
862
Now if I could get some real 'intelligence' from a picture. So I take a picture of a mountain 20 miles away, but I do not remember what direction I was facing, so how do I figure out what mountain I took a picture of :)
 

isladogs

CID VIP
Local time
Today, 02:35
Joined
Jan 14, 2017
Messages
14,036
Now if I could get some real 'intelligence' from a picture. So I take a picture of a mountain 20 miles away, but I do not remember what direction I was facing, so how do I figure out what mountain I took a picture of :)

LOL :D
But actually I think you could do so as the GPS EXIF data also tells you the direction you were facing when you took the photo

GPSImgDirectionRef STRING, Indicates the reference used for the captured direction.
[T" = True direction,"M" = Magnetic direction ]



Quite frightening really!
There really is nowhere to hide from GPS receivers.... :rolleyes:
 

Attachments

  • GPS EXIF Data.PNG
    GPS EXIF Data.PNG
    30.8 KB · Views: 110

isladogs

CID VIP
Local time
Today, 02:35
Joined
Jan 14, 2017
Messages
14,036

MickJav

It wasn't me
Local time
Today, 02:35
Joined
Nov 28, 2005
Messages
2,249
I've thinking lol


As my idear is to use your picture and map just updated for my project which will be a free program and an Accde due to code I used from total visual sourcebook I don't feel right if people think I did that work so will add a credit link on my about screen that is so people will still contact me with any problems within the program.


hope thats OK with you.


mick
 

isladogs

CID VIP
Local time
Today, 02:35
Joined
Jan 14, 2017
Messages
14,036
Hi Mick
That is the standard etiquette in such cases.
Perfectly happy for you to use my code in a free application. I appreciate you giving credit as suggested.
I would ask that you also do so in the code both for your own reference and in case you release a ACCDB version in the future.

How are the views from the top of the Kentish Alps?
 

MickJav

It wasn't me
Local time
Today, 02:35
Joined
Nov 28, 2005
Messages
2,249
Hi Mick
That is the standard etiquette in such cases.
Perfectly happy for you to use my code in a free application. I appreciate you giving credit as suggested.
I would ask that you also do so in the code both for your own reference and in case you release a ACCDB version in the future.

How are the views from the top of the Kentish Alps?


Alway leave any creidts in place.


My mates I go out riding with always seem to be able to find mountains to go up I'm normally too knackered to remember the mountain name lol



Think I have a fix for the rotation working on it at min It will be able to do one image like yours plus I think I have a way to batch update a folder just want to make sure it works then I'll post.
 

isladogs

CID VIP
Local time
Today, 02:35
Joined
Jan 14, 2017
Messages
14,036
If you look at my code, you will see I applied a rotation fix that works for most of the photos.
 

MickJav

It wasn't me
Local time
Today, 02:35
Joined
Nov 28, 2005
Messages
2,249
If you look at my code, you will see I applied a rotation fix that works for most of the photos.




I see that but your system uses the temp image mine wont work like that.

I have to correct the file then replace the original rotating 180 each time but still not working Code below


As the images correct when I rotate them in the default editor I thought it would work in code no such luck I will adapt my code to use your code but was hoping to be able to do a batch update which I won't be able to do now


Code:
Dim StrLoc As String, StrTemp As String, PFolders As String
Dim TempPic As String, MainPic As String, StrDim As String
Dim Boo As Boolean
Dim LngWidth As Long, LngHeight As Long
Dim mArray() As String

On Error GoTo HandleErr

StrLoc = DLookup("FolderLocation", "tblPreferences") 'Store the main folders location
StrTemp = "Temp Pictures\" 'The place the picture will be copied to
PFolders = Left$(Me![Stored], InStrRev(Me![Stored], "\")) 'Find The Folder list in the stored location I.E. \Kylie\Pictures\
TempPic = Trim(CurrentProject.Path & "\" & Replace(Me![Stored], PFolders, StrTemp)) 'Setup the tempory location for the picture in local folder
MainPic = Trim(StrLoc & Me![Stored]) 'Set the location of the original location
If adhFileExists(MainPic) Then
'First Do 180 Into Temp folder
Boo = WIA_RotateImage(MainPic, TempPic, 180)
End If

'Now check for success If Boo=true Delete The Main Picture
'If Not True Get Out Add Msgbox code
If Not Boo Then Exit Sub
DeleteFile MainPic
Boo = False
If adhFileExists(TempPic) Then
'First Do 180 Into Temp folder
Boo = WIA_RotateImage(TempPic, MainPic, 180)
End If

'Now Update The Picture PS you don't really need this but if theirs a probem It will show here
Me![Pic].Picture = MainPic

'Delete Temp Picture
If Not Boo Then Exit Sub
DeleteFile TempPic

'Now Get The Dimensions and calc the Orientation
StrDim = GetDimensions(MainPic)
mArray = Split(StrDim, "x")
LngWidth = CLng(Trim(mArray(0)))
LngHeight = CLng(Trim(mArray(1)))
'Update The Field
Me![Orientation] = StrDim
'Now Comes the Portate/landscape
If LngHeight > LngWidth Then
    Me![Orientation] = "Portrait"
'Their is a very slight chance they will be same so do this
Else
    Me![Orientation] = "Landscape"
End If
HandleExit:
    Exit Sub
    
HandleErr:
    Select Case Err.Number
        Case Else
            MsgBox Err.Number & vbCrLf & Err.Description
            Resume HandleExit
        Resume
    End Select
 
Last edited:

MickJav

It wasn't me
Local time
Today, 02:35
Joined
Nov 28, 2005
Messages
2,249
Got it working but only for 90 each push so will haveto live with that


Code:
Dim StrLoc As String, StrTemp As String, PFolders As String
Dim TempPic As String, MainPic As String, StrDim As String
Dim Boo As Boolean
Dim LngWidth As Long, LngHeight As Long
Dim mArray() As String

On Error GoTo HandleErr

StrLoc = DLookup("FolderLocation", "tblPreferences") 'Store the main folders location
StrTemp = "Temp Pictures\" 'The place the picture will be copied to
PFolders = Left$(Me![Stored], InStrRev(Me![Stored], "\")) 'Find The Folder list in the stored location I.E. \Kylie\Pictures\
TempPic = Trim(CurrentProject.Path & "\" & Replace(Me![Stored], PFolders, StrTemp)) 'Setup the tempory location for the picture in local folder
MainPic = Trim(StrLoc & Me![Stored]) 'Set the location of the original location
If adhFileExists(MainPic) Then
'First Do 180 Into Temp folder
Boo = WIA_RotateImage(MainPic, TempPic, 90)
End If

'Now check for success If Boo=true Delete The Main Picture
'If Not True Get Out Add Msgbox code
If Not Boo Then Exit Sub
DeleteFile MainPic
Boo = False
If adhFileExists(TempPic) Then
'First Do 180 Into Temp folder
MoveFiles TempPic, MainPic
End If

'Now Update The Picture PS you don't really need this but if theirs a probem It will show here
Me![Pic].Picture = MainPic

'Now Get The Dimensions and calc the Orientation
StrDim = GetDimensions(MainPic)
mArray = Split(StrDim, "x")
LngWidth = CLng(Trim(mArray(0)))
LngHeight = CLng(Trim(mArray(1)))
'Update The Field
Me![Orientation] = StrDim
'Now Comes the Portate/landscape
If LngHeight > LngWidth Then
    Me![Orientation] = "Portrait"
'Their is a very slight chance they will be same so do this
Else
    Me![Orientation] = "Landscape"
End If
HandleExit:
    Exit Sub
    
HandleErr:
    Select Case Err.Number
        Case Else
            MsgBox Err.Number & vbCrLf & Err.Description
            Resume HandleExit
        Resume
    End Select
 

isladogs

CID VIP
Local time
Today, 02:35
Joined
Jan 14, 2017
Messages
14,036
Just got home and haven't read your code.
Just out of interest why can't you use a temp image as I do to avoid altering the original image?
 

MickJav

It wasn't me
Local time
Today, 02:35
Joined
Nov 28, 2005
Messages
2,249
Just got home and haven't read your code.
Just out of interest why can't you use a temp image as I do to avoid altering the original image?


I use thumbnails and not all pictures need adjusting At the moment the program checks for a thumbnail if not found it looks in the main folder I don't want to compilcate it even more the second code works great I just do wht you do but delete the old main image then move the temp file been testing all night without a problem.


 

Users who are viewing this thread

Top Bottom