There is no calculateable distance. It can be calculated for different cases, and we can make a guess. But Tolkien used it as a plot device.
Voronwë's answer is but one of three cases, claiming that as the canonical answer is bad scientific practice.
There were three occasions were Sting was observed to have glowed in the presence of orcs.
- With Bilbo in the Goblin Caves
- With Frodo in the Mines of Moria
- With Frodo at Amon Hen
In the Goblin caves after Bilbo is dropped the first time he sees his glowing sword.
Now he drew it out. It shone pale and dim before his eyes. “So it is an elvish blade, too,” he thought; “and goblins are not very near, and yet not far enough."
This doesn't give us an accurate description of how far away they were. So we'll have to look at another example.
The next mention of the sword glowing is just before Bilbo was lead down the passages by Gollum. This doesn't give us a good indication as the orcs could be 20m away or they could be over a thousand meters away.
So lets look at Frodo in the Mines of Moria
Another harsh horn-call and shrill cries rang out. Feet were coming down the corridor. There was a ring and clatter as the Company drew their swords. Glamdring shone with a pale light, and Sting glinted at the edges.
This is the same description as before. This gives us some idea of how far away the orcs may have been. A description of the size of Moria is give here.
As for the corridor outside the Chamber of Mazarbul, I wouldn't predict it to be extremely long, as what would be the point of a single corridor that's extremely long. I would say it could be anywhere up to a maximum of a couple hundred meters. But definitely no where near to a kilometre away.
This leaves us with the final case
At Amon Hen
As outlined in Voronwë's answer. He claims it to be 1000m. I say this is grossly wrong because the orcs were not near Amon Lhaw. They were near Amon Hen. As that is where the Fellowship got attacked. The Orcs were definitely far closer putting them again (according to Voronwë's maths) at around at most 1700 feet, ~500 metres.
I don't think there was a canonical distance, it was really up to Tolkien to use it as a plot device.