A two-mile section of the former Salisbury to Wimborne railway line will be transformed into a public footpath.