Function Repository Resource:

ExifAltitude

Source Notebook

Extract the elevation that an image was taken at with the EXIF metadata attached to a file

Contributed by: Peter Cullen Burbery

ResourceFunction["ExifAltitude"][img]

extracts the elevation that the input image img was taken at using its EXIF metadata.

ResourceFunction["ExifAltitude"][url]

extracts the elevation of the image at the URL url.

Examples

Basic Examples (1) 

Find the elevation in meters from an image taken from Drinko Library at Marshall University (WV):

In[1]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/dfcd75f4-ef11-4782-8698-34686dd77ace"]
Out[1]=

Neat Examples (2) 

Find the elevation for an image:

Find the height of an image on Wikimedia Commons:

In[2]:=
ResourceFunction["ExifAltitude"][
 URL["https://upload.wikimedia.org/wikipedia/commons/2/22/YMCA_May_Building_in_Huntington_West_Virginia_late_at_night_in_February_2022.jpg"]]
Out[2]=

Import the image from Wikimedia Commons and export it to the Wolfram Cloud in the JPEG format with the URL ymca-may-building:

In[3]:=
Import[URL[
   "https://upload.wikimedia.org/wikipedia/commons/2/22/YMCA_May_Building_in_Huntington_West_Virginia_late_at_night_in_February_2022.jpg"]];
cloudobject = CloudExport[
   Import[URL[
     "https://upload.wikimedia.org/wikipedia/commons/2/22/YMCA_May_Building_in_Huntington_West_Virginia_late_at_night_in_February_2022.jpg"]], "JPEG", "ymca-may-building", Permissions -> {All -> {"Read"}}];

Import the cloud object:

In[4]:=
Import[cloudobject]
Out[4]=

Find the height of the image imported from the cloud:

In[5]:=
ResourceFunction["ExifAltitude"][CloudImport[cloudobject]]
Out[5]=

Alternatively, import from the URL directly:

In[6]:=
ResourceFunction["ExifAltitude"][URL[Extract[cloudobject, {1}]]]
Out[6]=

Possible Issues (2) 

The input must be an image in order to get a result:

In[7]:=
ResourceFunction["ExifAltitude"][1]
Out[7]=

ExifHeightData returns unevaluated if the file has no EXIF height data included:

In[8]:=
ResourceFunction["ExifAltitude"][
 ExampleData[{"AerialImage", "Earth"}]]
Out[8]=

Publisher

Peter Burbery

Requirements

Wolfram Language 13.2 (December 2022) or above

Version History

  • 1.0.0 – 02 June 2023

Related Resources

License Information