How to calculate distance


How to track driving distance , as long as I’m driving and the app is opened.

I’d like to keep track of the distance in km (kilometers) and meters if very slow, and show the total as well or just show the total as long as driving and not standing still .

Is this possible? What blocks should i use to achieve this . (Something with the Location sensor?)