4/ There are also many sites online that let you see a photoβs Exif data. Hereβs an example: https://jimpl.com
Top-level
4/ There are also many sites online that let you see a photoβs Exif data. Hereβs an example: https://jimpl.com 14 comments
6/ How? Two steps: 1. get the coordinates from the exif data in the image 2. reverse geocode the coordinates into useful location information Let's show a code example in javascript 7/ Step 1 is accessing the exif data in the image. There are software libraries in almost every programming language to do this. In our example we'll use the javascript "exif-js" library. 8/ π¨ note: an image might not have this data. It may not have been recorded or might have been removed later. Newer operating systems make it easy to turn geolocation recording on and off, in general or for a specific photo 9/ Exif standard specifies that the location be stored as longitude and latitude in DMS (degrees minutes seconds) format. So we need get the location info and turn it into decimal format. Some exif libraries have the option to do this conversion for you. 10/ Now we pass the decimal coordinates to our geocoding API and get the location π 11/ π¨ WAIT!!! π¨ The precision of the Exif coordinates depends on the tech (GPS, cell, etc) used to capture the location. So they may not be perfectly precise. But also showing a precise location might not be appropriate or have privacy implications. See our guide on how to show less precise location like just the city or neighbourhood: https://opencagedata.com/guides/how-to-preserve-privacy-by-showing-only-an-imprecise-location 12/ Precise geocoding might not make sense. Example: a tourist taking a picture right by the Eiffel Tower πΌ in Paris π«π·, probably wants their image geocoded as "Eiffel Tower" not the exact street address. We offer this as a service to several large image processing customers. 13/ Now you know how to turn Exif data from images into useful geographic information. You can find the javascript code example and more background info over in our guide to reverse geocoding images: 14/ Thanks for reading (and sharing), we hope you enjoyed this #geoeducation thread. We have many more threads about the #geoweirdness of specific countries, border disputes, geocoding, etc on our blog. Some still on twitter, but week by week we are moving them to mastodon (and writing new threads) @opencage assuming you have that info in EXIF data, can you identify that the camera was pointing towards the Eiffel tower rather than away from it? Just to make sure that this is really what's in the frame. Focusing distance might be useful too. @brunogirin Yes, can be done, but a simpler solution is just provide the user with both responses (precise address and nearby POI) and let them then choose which one is appropriate for the situation @opencage Writing EXIF readers is a pain the proverbial behind though. As with so many standards all camera manufacturers add their own proprietary extensions :-/ @derickr yes, this is why you should use an open source library where we can all work together. It's never easy, Derick. |
5/ These days the most widely used cameras πΈ are mobile phones π± and phones generally know their location (from GPS, cell, wifi, etc).
Many phones record this location info in the exif data. We can extract and reverse geocode the location the photo was taken.
#geoeducation