distance extraction