I want to go to London. It is ten miles form here.

------------------------------
Does 'it' refer to 'London'? Or does it refer to 'the distance' used as an impersonal pronoun?

===============================
How far is it from here to the station?
(Here 'it' is an impersonal pronoun referring to the distance, right?)

Yes, "it" refers to London in that sentence.

I want to go to London. It is ten miles from here. (Thank you.)

Yes, right!!

=)

In the first sentence, "it" refers to "London," as it is the destination being referred to. The sentence states that London is ten miles away from the current location.

In the second sentence, "it" does indeed refer to "the distance." The sentence is asking about the distance from the current location to the station.