Conditionals in .fmt files

Started by samk, April 28, 2021, 07:17:31 PM

Previous topic - Next topic

samk

Hello,

Is it possible to add values to conditionals in the print format files?

I am trying to check if GPS telemetry is not zeroed out (from a video file). Right now, I simply check for its existence with:


#[IF]  $gpslatitude $gpslongitude $sampletime
#[BODY]<trkpt>
#[BODY]  <lat>$gpslatitude#</lat>
... etc.


Is it possible to check if those GPS latitudes and longitudes do not equal to zero? If so, how would I go about doing this?

Thanks, and apologies if this has already been answered

Phil Harvey

Sure.  You can do something like this:

#[IF]  ${gpslatitude;$_ = undef if $_ == 0} ${gpslongitude;$_ = undef if $_ == 0} $sampletime

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

samk


Phil Harvey

Oh.  Actually for this to work properly you need to test the numerical value:

#[IF]  ${gpslatitude#;$_ = undef if $_ == 0} ${gpslongitude#;$_ = undef if $_ == 0} $sampletime
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).