added function to map for local distances