Obtain geolocation data from Image (1 Viewer)

kevlray

Registered User.
Local time
Today, 14:46
Joined
Apr 5, 2010
Messages
1,046
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

MVP / VIP
Local time
Today, 21:46
Joined
Jan 14, 2017
Messages
18,186
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: 388

isladogs

MVP / VIP
Local time
Today, 21:46
Joined
Jan 14, 2017
Messages
18,186

Dreamweaver

Well-known member
Local time
Today, 21:46
Joined
Nov 28, 2005
Messages
2,466
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

MVP / VIP
Local time
Today, 21:46
Joined
Jan 14, 2017
Messages
18,186
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?
 

Dreamweaver

Well-known member
Local time
Today, 21:46
Joined
Nov 28, 2005
Messages
2,466
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

MVP / VIP
Local time
Today, 21:46
Joined
Jan 14, 2017
Messages
18,186
If you look at my code, you will see I applied a rotation fix that works for most of the photos.
 

Dreamweaver

Well-known member
Local time
Today, 21:46
Joined
Nov 28, 2005
Messages
2,466
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:

Dreamweaver

Well-known member
Local time
Today, 21:46
Joined
Nov 28, 2005
Messages
2,466
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

MVP / VIP
Local time
Today, 21:46
Joined
Jan 14, 2017
Messages
18,186
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?
 

Dreamweaver

Well-known member
Local time
Today, 21:46
Joined
Nov 28, 2005
Messages
2,466
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