How far is it from this town to London?
1. It is ten miles to London.
2. It is ten miles away to London.
3. It is ten miles away.
4. It is ten miles from this town to London.
-------------------
[Explanation]
1. It doesn't refer to 'this town' in #1. It is an impersonal pronoun. In #1, it refers to the distance.
2. In #2, it also refers to 'the distance.' Does 'it' refer to 'this town'?
3. In #3, it refers to 'the distance.' It doesn't refer to 'this town' or 'London.'
4. Definitely 'it' is an impersonal pronoun. 'It' refers to 'the distance' here.
(What do you think of my explanation? Would you correct some?)