I try to use the photos module to set the GPS tags/exifs of a photo.
If I pick two assets from the camera roll, a1 which has GPS tags and a2 without GPS tags, and if my script does
a2.location = a1.location
the standard Photos app shows correctly where the photo has been taken,
but other applications do not find the GPSInfo exif in the photo file.
Smallest code for testing, assuming you pick 2 photos, the first one having GPS tags, the 2nd not.
# coding: utf-8
import photos
def main():
c = photos.get_assets(media_type='image')
ps = photos.pick_asset(assets=c, title='Pick photos', multi=True)
for p in ps:
print(p.location)
if p.location:
# Photo has GPS tags
prev_location = p.location
else:
# Photos does not have GPS tags, use previous if any
if prev_location:
p.location = prev_location
if __name__ == '__main__':
main()