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

GPS Tag Write not setting negative #131

Closed
contd opened this issue Feb 11, 2023 · 6 comments
Closed

GPS Tag Write not setting negative #131

contd opened this issue Feb 11, 2023 · 6 comments

Comments

@contd
Copy link

contd commented Feb 11, 2023

This maybe a dumb question given my limited knowledge of GPS data but when I try to set the Latitude and Longitude tags they get set to only positive numbers.

let file = "/path/to/photo.jpg";
let lattitude = 39.1132577;
let longitude = -84.6907715;
await exiftool.write(file, { GPSLatitude: lattitude });
await exiftool.write(file, { GPSLongitude: longitude });

When I open the file it shows the GPS as 39.1132577 latitude and 84.6907715 longitude (middle of the ocean). I feel like I a missing something and its pretty simple. Everything else I've used this for works great! Thanks!

mceachen added a commit that referenced this issue Feb 12, 2023
@mceachen
Copy link
Member

mceachen commented Feb 12, 2023

I've just pushed a test that verifies that all combinations of negative, zero, and positive values for GPS work properly on all platforms. See https://github.com/photostructure/exiftool-vendored.js/actions/runs/4154789945 and d9bfd9a (these tests pass on Windows using an older build, fwiw).

Note that you don't want to call write twice in your example, and I expect that's your issue. This is what your code should look like:

const GPSLatitude = 39.1132577;
const GPSLongitude = -84.6907715;
await exiftool.write(file, { GPSLatitude, GPSLongitude });

@mceachen
Copy link
Member

Looks like this works correctly if I change ExifTool to v12.50, but fails on 12.55. It may be in my code or in ExifTool--I need to look into it more.

You can try it locally by editing this section of the package.json:

  "optionalDependencies": {
    "exiftool-vendored.exe": "12.50.0",
    "exiftool-vendored.pl": "12.50.0"
  }

I'll get this addressed in the next day or two. Thanks for the bug report!

@contd
Copy link
Author

contd commented Feb 12, 2023

I tried your approach and got the same result. I also tried to to null them first then go back and set them and it still set the GPSLongitude to positive.

const GPSLatitude = 39.1132577;
const GPSLongitude = -84.6907715;
await exiftool.write(file, {GPSLatitude: null, GPSLongitude: null});
await exiftool.write(file, { GPSLatitude, GPSLongitude });

I changing the optionalDependencies like you mentioned and first got the same result. Then I realized I needed to npm install in the exiftool-vendored dir in node_modules before re-running and then boom it worked!!

Thanks for this and I'm happy to help any further.

@mceachen
Copy link
Member

mceachen commented Feb 12, 2023

I looked at the recent git logs for exiftool and didn't see a smoking gun there. I posted a bug report to their forum--they're really responsive.

mceachen added a commit that referenced this issue Feb 13, 2023
@mceachen
Copy link
Member

According to the ExifTool Gurus, I need to specify the Ref explicitly to handle different filetypes. I've just made this change to the branch--if it passes on all platforms, I can ship the bugfix.

@mceachen
Copy link
Member

Merged to main and released. Thanks again for the bug report!

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