With -c "%.6f", I get this: 42.467761 N, 2.447175 W
With -c "%+.6f", I get this: +42.467761, -2.447175
Is there a way for me to get 42.467761, -2.447175 ?
I think you mean -c "%+.6f for your second command.
Generally one uses -n for numerical output, but this gives the full precision.
However, there are other ways to deal with this depending on what output formatting you are using. With -p you could use the advanced formatting feature.
Alternatively you could apply a blunt instrument to remove a leading "+" from all tag values:
exiftool -api filter="s/^\+//" ...
which will filter GPSLatitude and GPSLongitude, but not the 2nd coordinate of GPSPosition. I don't know what options you are using.
- Phil
Yes, copy/paste, but I was sure I had added the plus in. The output is a .gpx file with a -p template. Changing the command to
exiftool -c "%+.6f" \
-api filter="s/^\+//" \
-p ~/bin/gpxl.fmt \
-userparam name="$3" \
-userparam desc="$4" $(ls | sort) > /tmp/${2}-l.gpx
worked perfectly.
The latest script and templates are attached for anyone interested.
OK. Perhaps a better way to do this is to drop the -c option and revise your -p format file to use expressions like this:
${gpslatitude#;$_=sprintf("%.6f",$_)}
- Phil
Quote from: Phil Harvey on December 24, 2022, 07:03:23 AM${gpslatitude#;$_=sprintf("%.6f",$_)}
That appears to work (without -c) but
#[BODY] <ele>${gpsaltitude#;$_=sprintf("%.1f",$_)}</ele>
on the next line creates precisions from one digit to six.
You want 1 digit after the decimal point, or 1 digit precision?
For 1 digit precision use "%.1g" instead of "%.1f". But it will switch to exponential format if the number is too high.
- Phil