ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   GPS Data from JPEG's (https://www.excelbanter.com/excel-programming/450824-gps-data-jpegs.html)

[email protected]

GPS Data from JPEG's
 
I have a large number of JPEG files taken from various phones that have GPS latitude and longitude data. I can view this data by looking up the file properties (details) individually in windows explorer.

Is it possible to retrieve this GPS data in VBA? I would like to retrieve the latitude and longitude for each file into a spreadsheet.

I'm using Windows 7 and Excel 365.

I did see some old posts that seemed to relate but the links to solutions were no longer valid.


Thanks in advance.

Maurizio Borrelli[_2_]

GPS Data from JPEG's
 
Il giorno luned́ 27 aprile 2015 04:16:46 UTC+2, ha scritto:
I have a large number of JPEG files taken from various phones that have GPS latitude and longitude data. I can view this data by looking up the file properties (details) individually in windows explorer.
Is it possible to retrieve this GPS data in VBA? I would like to retrieve the latitude and longitude for each file into a spreadsheet.
I'm using Windows 7 and Excel 365.
I did see some old posts that seemed to relate but the links to solutions were no longer valid.


Hi neilw...,
try:

Public Sub GetExtendedProperty_Test()
Const cstrPath As String = "D:\Path"
Const cstrFilename As String = "Filename.JPG"
Dim p As String

' System.Photo.CameraModel
p = GetExtendedProperty(cstrPath, _
cstrFilename, _
"{14B81DA1-0135-4D31-96D9-6CBFC9671A99}", _
272)
Debug.Print p

' System.GPS.Latitude
p = GetExtendedProperty(cstrPath, _
cstrFilename, _
"{8727CFFF-4868-4EC6-AD5B-81B98521D1AB}", _
100)
Debug.Print p

' System.GPS.Longitude
p = GetExtendedProperty(cstrPath, _
cstrFilename, _
"{C4C4DBB2-B593-466B-BBDA-D03D27D5E43A}", _
100)
Debug.Print p
End Sub

' Windows Properties
' https://msdn.microsoft.com/en-us/lib...77(VS.85).aspx
'
Public Function GetExtendedProperty(ByVal Path As String, _
ByVal Filename As String, _
ByVal formatID As String, _
ByVal propID As String)
Dim sh As Shell32.Shell
Dim fld2 As Shell32.Folder2
Dim fi As Shell32.FolderItem
Dim sfi As Shell32.ShellFolderItem

Set sh = CreateObject("Shell.Application")
Set fld2 = sh.Namespace(Path)
Set fi = fld2.ParseName(Filename)
Set sfi = fi
GetExtendedProperty = sfi.ExtendedProperty(formatID & CStr(propID))

Set sfi = Nothing
Set fi = Nothing
Set fld2 = Nothing
Set sh = Nothing
End Function

--
Ciao! :)
Maurizio

GS[_6_]

GPS Data from JPEG's
 
I have a large number of JPEG files taken from various phones that
have GPS latitude and longitude data. I can view this data by looking
up the file properties (details) individually in windows explorer.

Is it possible to retrieve this GPS data in VBA? I would like to
retrieve the latitude and longitude for each file into a spreadsheet.


I'm using Windows 7 and Excel 365.

I did see some old posts that seemed to relate but the links to
solutions were no longer valid.


Thanks in advance.


You need a file property reader, DsoFile.dll perhaps!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




All times are GMT +1. The time now is 04:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com