Trying to implement map-based distance calculation