This sounds like you need a developer. Sure you can perform calculations but you would need to know the starting point and end point of all locations. You could pass these with parameters to a hidden field via gravity forms and then render the calculation in a product field. If I’m not misspeaking.