London Banter

London Banter (https://www.londonbanter.co.uk/forum.php)
-   London Transport (https://www.londonbanter.co.uk/london-transport/)
-   -   Rail deserts (https://www.londonbanter.co.uk/london-transport/5788-rail-deserts.html)

Clive D. W. Feather November 1st 07 04:26 PM

Rail deserts
 
In article . com, Mr
Thant writes
I loaded all the station locations into a MySQL database, then wrote a
PHP script to generate an SVG file. I didn't bother calculating
distances - it just does separate passes to make the quarter mile
discs appear on top of the half mile discs, which achieves a similar
effect.


Oo, crafty. Let existing graphics software do all the heavy work.

--
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:

Clive D. W. Feather November 1st 07 04:26 PM

Rail deserts
 
In article , Jarle H Knudsen
writes
1 for each grid cell
2 best := infinity
3 for each station on the list
4 d := (distance from station to cell) squared
5 if d best then best := d
6 cell value := sqrt (best)


Why does the distance need to be squared in line 4?


What is the formula for distance between two points on a Cartesian grid?

--
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:

Mark Brader November 1st 07 11:45 PM

Rail deserts
 
Clive Feather:
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.


With suitable travel-time assumptions, you can make an "isochronic map"
like this one, which I occasionally use as a screen background:

http://www.mysociety.org/2006/travel...big-1177px.png

Delete the last component of the URL to see other examples by the same
people, and discussion. Google on "isochronic map" to see examples by
other people.
--
Mark Brader, Toronto | I am a mathematician, sir. I never permit myself
| to think. --Stuart Mills (Carr: The Three Coffins)

James Farrar November 2nd 07 03:18 AM

Rail deserts
 
On Fri, 02 Nov 2007 00:45:01 -0000, (Mark Brader) wrote:

Clive Feather:
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.


With suitable travel-time assumptions,


But not "time-travel", as I read it at first :)

[email protected] November 2nd 07 08:22 AM

Rail deserts
 
On 2 Nov, 00:45, (Mark Brader) wrote:
Clive Feather:

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.


With suitable travel-time assumptions, you can make an "isochronic map"
like this one, which I occasionally use as a screen background:

http://www.mysociety.org/2006/travel...al-london-big-...

Delete the last component of the URL to see other examples by the same
people, and discussion. Google on "isochronic map" to see examples by
other people.


According to your link Surbiton Station is nowhere near a station.


Jarle H Knudsen November 2nd 07 11:24 PM

Rail deserts
 
On Thu, 1 Nov 2007 17:26:38 +0000, Clive D. W. Feather wrote:

In article , Jarle H Knudsen
writes
1 for each grid cell
2 best := infinity
3 for each station on the list
4 d := (distance from station to cell) squared
5 if d best then best := d
6 cell value := sqrt (best)


Why does the distance need to be squared in line 4?


What is the formula for distance between two points on a Cartesian grid?


d = sqrt((x2 - x1)^2 + (y2 - y1)^2).

But that does not explain (to me) why you do d^2 in line 4.

--
jhk

Tim Woodall November 3rd 07 05:44 AM

Rail deserts
 
On Sat, 3 Nov 2007 01:24:15 +0100,
Jarle H Knudsen wrote:
On Thu, 1 Nov 2007 17:26:38 +0000, Clive D. W. Feather wrote:

In article , Jarle H Knudsen
writes
1 for each grid cell
2 best := infinity
3 for each station on the list
4 d := (distance from station to cell) squared
5 if d best then best := d
6 cell value := sqrt (best)

Why does the distance need to be squared in line 4?


What is the formula for distance between two points on a Cartesian grid?


d = sqrt((x2 - x1)^2 + (y2 - y1)^2).

But that does not explain (to me) why you do d^2 in line 4.

It's an optimization. You only have to calculate a square root once per
cell.

Tim.

--
God said, "div D = rho, div B = 0, curl E = - @B/@t, curl H = J + @D/@t,"
and there was light.

http://tjw.hn.org/ http://www.locofungus.btinternet.co.uk/

Tim Woodall November 3rd 07 05:56 AM

Rail deserts
 
On Mon, 29 Oct 2007 11:04:56 +0000,
Clive D. W. Feather wrote:
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.

I'd have thought a more useful optimization would be:
If D(x,y) = x^2 + y^2

then D(x+1, y) = D(x, y) + 2x + 1
D(x, y+1) = D(x, y) + 2y + 1
D(x-1, y) = D(x, y) - 2x + 1
D(x, y-1) = D(x, y) - 2y + 1

But optimizing without profiling is generally a complete disaster and
you've done this before but I haven't. ;-)


Tim.



--
God said, "div D = rho, div B = 0, curl E = - @B/@t, curl H = J + @D/@t,"
and there was light.

http://tjw.hn.org/ http://www.locofungus.btinternet.co.uk/

Ian Jelf November 3rd 07 05:14 PM

Rail deserts
 
In message , Mark Brader
writes
Clive Feather:
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.


With suitable travel-time assumptions, you can make an "isochronic map"
like this one, which I occasionally use as a screen background:


http://www.mysociety.org/2006/travel...london-big-117
7px.png


That, Mark, is seriously excellent!

(And could also get you at the very least a shortlisting for the Turner
Prize!)

In all seriousness, a *very* interesting exercise.
--
Ian Jelf, MITG
Birmingham, UK

Registered Blue Badge Tourist Guide for London and the Heart of England
http://www.bluebadge.demon.co.uk

Tom Anderson November 4th 07 01:35 PM

Rail deserts
 
On Sat, 3 Nov 2007, Ian Jelf wrote:

In message , Mark Brader
writes

With suitable travel-time assumptions, you can make an "isochronic map"
like this one, which I occasionally use as a screen background:

http://www.mysociety.org/2006/travel...big-1177px.png


That, Mark, is seriously excellent!

(And could also get you at the very least a shortlisting for the Turner
Prize!)


Or rather, for Tom Steinberg and, posthumously, Chris Lightfoot, who i
believe did the map.

tom

--
Science which is distinguishable from magic is insufficiently advanced


All times are GMT. The time now is 04:32 AM.

Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2006 LondonBanter.co.uk