Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request - exifr.gps() + Altitude #39

Closed
NickSutton opened this issue Sep 19, 2020 · 2 comments
Closed

Request - exifr.gps() + Altitude #39

NickSutton opened this issue Sep 19, 2020 · 2 comments

Comments

@NickSutton
Copy link

Hi,

I love the speed of the program only parsing certain lines, and I attempted exifr.parse(file, [latitude, longitude, GPSAltitude]) but got an error and would rather not have to do the conversion from decimal lat/lon on my part.

Could we have a exifr.gpsA() which returns the formatted lat/lon pair as well as the altitude (ideally rounded to 0 decimal places)?

Thanks so much for your work on this!

One more thing, I tried to parse from a URL (hosted on Twilio, and involves a number of redirects, but it didn't seem to get to the image? Is there a way I can share a link with you privately?

Thanks,
TM

@MikeKovarik
Copy link
Owner

Hello, thanks for using the library. I'm on a vacation right now so I can't fully look into it yet.

Could you elaborate about what goes with with the snippet you used. The concrete error it throws, or something I can latch onto while debugging?

gpsa() I guess we can do that. I never encountered usable and reliable altitude field in any photo so it haven't crossed my mind yet.

Url fetching in exifr is very basic. It can't handle redirects or any other difficult cases. There are many http libraries out there and not using one would require to implement it myself in exifr. That's a whole lot a of work, source of bugs, inflated file size, etc... Exifr is just the image parser (plus some sugar-y methods here and there). Sorry. You will have to fetch the file in your code and feed the buffer into exifr.

I'll get back to you when I return.
Thanks. Mike

@MikeKovarik
Copy link
Owner

Hello.
So I thought about it and I'm closing this with a no. It is a very specific request which would not bring that much of a value when compared to increased file size. But fear not. It's not like you cannot achieve what you want with already existing API.

let tags = [
  'GPSLatitude',    'GPSLongitude',    'GPSAltitude',
  'GPSLatitudeRef', 'GPSLongitudeRef', 'GPSAltitudeRef',
]
let output = await exifr.parse(file, tags)

and the output is

{
  GPSLatitudeRef: 'N',
  GPSLatitude: [ 50, 17, 58.57 ],
  GPSLongitudeRef: 'E',
  GPSLongitude: [ 14, 49, 13.06 ],
  GPSAltitudeRef: Uint8Array(1) [ 0 ],
  GPSAltitude: 252,
  latitude: 50.29960277777778,
  longitude: 14.820294444444444
}

Important to note: you cannot use 'latitude', 'longitude' in the tags argument exifr.parse(file, [...]) because those are not a real tags that can be extracted. These are calculated on the fly by exifr, if there's GPSLatitudeRef and GPSLatitude or GPSLongitudeRef and GPSLongitude in the output. So by requesting these (along with GPSAltitude) you get all you want, both in processed and raw form.

I know you mentioned some error occurred with this approach but I believe it was a typo (maybe you didn't use strings in the array), or there's a bug in exifr. In which case, I'd love to look into it if you provide me with the image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants