Summ up between events
Don't use '' to indicate missing lat/lng -- use NULL instead.  Meanwhile keep lat/lng in, say FLOAT.  See: http://mysql.rjweb.org/doc.php/latlng#representation_choices

If you are using MySQL 8.0 or Mariadb 10, use LEAD(1) and OVER ( PARTITION BY chargeNumber ORDER BY tag_id ) to get the calculate drive distances and the first lat-lng per charge.  In the absence of that windowing function, it would be better to do the arithmetic in your application.


Use LEAD(1) to find the distance for each distance.
SUM() with GROUP BY chargeNumber to get the total distance for each charge.


Be aware that the drive-distance falsely assumes a straight line.