Awesome, thanks very much! It works great!
I added 2 new tags for the infobar:
{altitudeft} = Altitude in Feet
{distancemi} = Distance in Miles
Here are the sections of code I updated:
process_data: function (data, options)
// Added opts for altitudeft, distancemi (billw 10/11/18)
this.set_mydata(options.div_id, options.track_id, 'altitude_ft', o.metadata.last_trkpt_altitude_ft);
this.set_mydata(options.div_id, options.track_id, 'distance_mi', o.metadata.distance_mi);
if (alltracks && alltracks[track_id])
// Added opts for altitudeft, distancemi (wcw 10/11/18)
var altitude_ft = alltracks[track_id].metadata.last_trkpt_altitude_ft;
var distance_mi = alltracks[track_id].metadata.distance_mi;
if (mymapdata.infobar)
infobar_text = infobar_text.replace(/\{altitudeft\}/gi, altitude_ft);
infobar_text = infobar_text.replace(/\{distancemi\}/gi, distance_mi);
function get_metadata( $row, $extra_metadata = array() )
// Added opts for altitudeft, distancemi (billw 10/11/18)
'last_trkpt_altitude_ft' => number_format( (float) $row['altitude'] * 3.28084, 0),
'distance_mi' => number_format( (float) $row['distance'] * 0.0006213712, 2 ),
// Added opts for altitudeft, distancemi (billw 10/11/18) (also {distance} was missing)
printf(
$format,
esc_html__( 'With live tracking, an information bar can be shown on the map, displaying some data from the latest trackpoint. ' .
'Here you can format the content of the infobar. Possible replacement tags are {lat}, {lon}, {timestamp}, {altitude}, {altitudeft}, ' .
'{speedms}, {speedkmh}, {speedmph}, {distance}, {distancemi}, {userid}, {userlogin}, {displayname}.', 'trackserver' )
);
If others are interested in this, perhaps you could roll it into your code when you have a chance. Thanks again for all your work on this great plugin!
-Bill