Calculate distance to nearest marker