Page 1 of 1

finding towns within a radius of a given town.

Posted: Sun Feb 29, 2004 2:17 pm
by muppet
Hi,
I'm trying to build a script that will list all the towns in a given radius centred around a town pulled from a database. Has any one got any suggestions or sources of info. I haven't really got a clue where to start.......... 8O

Posted: Sun Feb 29, 2004 2:35 pm
by Dr Evil
The only way I can imagine is to give each town an x,y or long., lat. coordinate. You can then, from the starting town, define a square "radius" (d).

x-d<x<x+d
y-d<y<y+d

If you want to have a circular radius things get more complicated. You need to use trigonometry and the SQL query, I think, would be more complicated.

Posted: Sun Feb 29, 2004 2:48 pm
by muppet
Thanks for that.
My next question would be - do you know where I can source a list of towns with co-ords which covers - wait for it - UK initially then Europe.

Don't want much do......... :wink:

Posted: Sun Feb 29, 2004 3:01 pm
by Dr Evil
You are looking at a complicated problem here. This can turn out to be very costly (Mappoint, Mapquest) as you won't (according to me) find a free database. The data is very big and it is usually accessed via the web.

Here is an article on GIS:
http://www.phpbuilder.com/columns/moss20031023.php3

and a uk based site for GIS:
http://www.emapsite.com/

Good Luck

Posted: Sun Feb 29, 2004 3:05 pm
by muppet
Many thanks, much appreciated. I'm trying not to think too much about cost or size of the project - far too scary at this stage.

Thanks again.

SMIFFY :D