Sir, I am actually trying to use the distance function to calculate distance. Please see line 487. I guess this will not be possible without creating features.