Rail deserts
In article , Tom
Anderson writes
I'm trying to figure out how to program a computer to find these
automatically.
The approach I've taken in the past is very simple. Start with a grid
representing the entire area (to make it easy, say 1000 x 1000 with one
unit on the grid being 100 metres). Set up a list of locations of all
the stations. Then:
for each grid cell
best := infinity
for each station on the list
d := (distance from station to cell) squared
if d best then best := d
cell value := sqrt (best)
You can optimize things slightly by using a lookup table for the square
roots rather than calculating them each time.
When you've finished, the grid holds the distance to the nearest
station. Convert it to a GIF and fiddle with the colour map and, for
example, you can have a map where places within 1km of a station are
green, within 2km are yellow, and more than 2km are red.
--
Clive D.W. Feather | Home:
Tel: +44 20 8495 6138 (work) | Web: http://www.davros.org
Fax: +44 870 051 9937 | Work:
Please reply to the Reply-To address, which is:
|