473,473 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do they do that? long/lat in database then measuring distances between

Hello
I wonder if anyone can help.

I would like to know how certain sites:
http://aboutbritain.com/ArundelCastle.htm, and
http://travel.knowhere.co.uk/place/+bristol-0/ manage to put approx mile
distances between their listed towns and attractions.
You will see it on the knowhere.co.uk site on the right side where they list
nearby towns and on aboutbritain.com you will see it where they list other
nearby attractions and hotels towards the bottom of the page.
I guess they store longitude/latitude in their database so they can pinpoint
each attraction/hotel ETC, but what then. How do they calculate distances
between those hotels and attractions and other towns?

Also, the database on my site has alot of places stored but with postcodes.
Is there a way of converting postcodes into approximate long/lat positions?
Like a universally available table or something?

My programmer is back tomorrow from his holidays and I'm trying to gather as
much information about 'how it's done' so I can get a similiar system
implemented on my website. My new website will be describing thousands of
British villages and storing them in a mySQL database and I'm looking at
ways of listing the nearest attractions to them. The site uses alot of php.
If my programmer does not contact me on his return (he often obsconds for
lengthy periods) I will be looking for someone who can do this sort of work
and other work. Must be reasonable! and reliable!

If anyone can help I'd be most grateful.

Kind Regards,
Jayne Wolps
Jul 17 '05 #1
7 4089
Jayne Wolps wrote:
Hello
I wonder if anyone can help.

I would like to know how certain sites:
http://aboutbritain.com/ArundelCastle.htm, and
http://travel.knowhere.co.uk/place/+bristol-0/ manage to put approx mile
distances between their listed towns and attractions.
You will see it on the knowhere.co.uk site on the right side where they list
nearby towns and on aboutbritain.com you will see it where they list other
nearby attractions and hotels towards the bottom of the page.
I guess they store longitude/latitude in their database so they can pinpoint
each attraction/hotel ETC, but what then. How do they calculate distances
between those hotels and attractions and other towns?
Pythagoras comes to the rescue here:
distance from (ax,ay) to (bx,by)
= square root ( ((bx-ax)^2) + ((by-ay)^2) )
Also, the database on my site has alot of places stored but with postcodes.
Is there a way of converting postcodes into approximate long/lat positions?
Like a universally available table or something?


This site has a table of postcode locations
http://www.jibble.org/ukpostcodes/
Jul 17 '05 #2
Uzytkownik "Kevin Thorpe" <ke***@pricetrak.com> napisal w wiadomosci
news:40***********************@news.easynet.co.uk. ..
Pythagoras comes to the rescue here:
distance from (ax,ay) to (bx,by)
= square root ( ((bx-ax)^2) + ((by-ay)^2) )


I wonder if the sum of the difference in x and the difference in y wouldn't
better approximates the distance people actually would need to travel,
considering that city streets are usually arrange in a grid.
Jul 17 '05 #3
On Mon, 23 Feb 2004 17:16:23 +0000, Kevin Thorpe <ke***@pricetrak.com>
wrote:
Jayne Wolps wrote:
Hello
I wonder if anyone can help.

I would like to know how certain sites:
http://aboutbritain.com/ArundelCastle.htm, and
http://travel.knowhere.co.uk/place/+bristol-0/ manage to put approx mile
distances between their listed towns and attractions.
You will see it on the knowhere.co.uk site on the right side where they list
nearby towns and on aboutbritain.com you will see it where they list other
nearby attractions and hotels towards the bottom of the page.
I guess they store longitude/latitude in their database so they can pinpoint
each attraction/hotel ETC, but what then. How do they calculate distances
between those hotels and attractions and other towns?


Pythagoras comes to the rescue here:
distance from (ax,ay) to (bx,by)
= square root ( ((bx-ax)^2) + ((by-ay)^2) )
Also, the database on my site has alot of places stored but with postcodes.
Is there a way of converting postcodes into approximate long/lat positions?
Like a universally available table or something?


This site has a table of postcode locations
http://www.jibble.org/ukpostcodes/

Jayne

PostCodes won't help as they are not arranged in that way in the UK. I
think a better and much more accurate way would be to use grid
coordinates. The Ordinance Survey grid is arranged in Eastings and
Northings and is measured in metres so a straightforward search in a
database for all locations within a rectangle around your location is
fairly easy. The distance can be calculated using simple trig. Lats
and Longs could also be used but the maths get a bit tricky. You can
also pass on the grid reference so that users can find the location on
their map or provide a button to link to a mapping web site. If you
want to add a map to your web pages, try http://www.map24.co.uk

regards
Trevor
Jul 17 '05 #4
Kevin Thorpe wrote:
Jayne Wolps wrote:
Hello
I wonder if anyone can help.

I would like to know how certain sites:
http://aboutbritain.com/ArundelCastle.htm, and
http://travel.knowhere.co.uk/place/+bristol-0/ manage to put approx mile
distances between their listed towns and attractions.


Pythagoras comes to the rescue here:
distance from (ax,ay) to (bx,by)
= square root ( ((bx-ax)^2) + ((by-ay)^2) )
Also, the database on my site has alot of places stored but with
postcodes. Is there a way of converting postcodes into approximate
long/lat positions? Like a universally available table or something?


This site has a table of postcode locations
http://www.jibble.org/ukpostcodes/


Note quite. Over VERY short distances (<50km or ~30mi) pythagoras is OK,
but keep in mind LAT/LONG coordinate system is essentially a polar system
in 3 dimensions (pythagoras is planar in 2 dimensions). Google the whole
lat/long distance thing. There are plenty of sites showing the mathematics
to achieve acurate distances between 2 lat/long's - I've seen the raw
formulae and various implementations from MS-Excell to C/C++ and even PCM!

James
--
Fortune cookie says:
Oh yeah? Well, I remember when sex was dirty and the air was clean.

Jul 17 '05 #5
"Jayne Wolps" <jaynewolps(nospam)@hotmail.com> wrote in message news:<c1**********@hercules.btinternet.com>...
Hello
I wonder if anyone can help.

I would like to know how certain sites:
http://aboutbritain.com/ArundelCastle.htm, and
http://travel.knowhere.co.uk/place/+bristol-0/ manage to put approx mile
distances between their listed towns and attractions.
You will see it on the knowhere.co.uk site on the right side where they list
nearby towns and on aboutbritain.com you will see it where they list other
nearby attractions and hotels towards the bottom of the page.
I guess they store longitude/latitude in their database so they can pinpoint
each attraction/hotel ETC, but what then. How do they calculate distances
between those hotels and attractions and other towns?


- http://distance-calculation.com/Dist...alculation.asp
- http://www.phparchitect.com/sample.p...show=316&mid=9

HTH

--
"Success is not what you achieve, but it is what you die for"
If you live in USA, please support John Edwards.
Email: rrjanbiah-at-Y!com
Jul 17 '05 #6
> Note quite. Over VERY short distances (<50km or ~30mi) pythagoras is OK,
but keep in mind LAT/LONG coordinate system is essentially a polar system
in 3 dimensions (pythagoras is planar in 2 dimensions). Google the whole
lat/long distance thing. There are plenty of sites showing the mathematics
to achieve acurate distances between 2 lat/long's - I've seen the raw
formulae and various implementations from MS-Excell to C/C++ and even PCM!


True. However, if you want the rough distance to the closest hotel etc
then the difference between pythagoras and a spherical solution only
becomes significant when you wouldn't want to go there anyway.

To calculate distances for aeroplane flights I would use a sperical
solution. For nearest hotel it isn't worth the cycles.
Jul 17 '05 #7
On Wed, 25 Feb 2004 09:56:30 +0000, Kevin Thorpe <ke***@pricetrak.com>
wrote:
True. However, if you want the rough distance to the closest hotel etc
then the difference between pythagoras and a spherical solution only
becomes significant when you wouldn't want to go there anyway.


Not quite correct. The latitude and longitude scales are in the same
units, but actually use a different scale. This is almost the same at
the equator, but diverges towards the poles. For the UK using
pythagoras would give you a distance approx double the actual value.

Paul Brooks
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jayne Wolps | last post by:
Hello I wonder if anyone can help. I would like to know how certain sites: http://aboutbritain.com/ArundelCastle.htm, and http://travel.knowhere.co.uk/place/+bristol-0/ manage to put approx...
182
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
74
by: Dominik Wallner | last post by:
Hi! I'm currently implementing a program which measures voltages through an external USB-AD-converter. It should output those values as time/voltage pairs. My problem is to measure the time...
13
by: racygirl | last post by:
Hi all, I was just wondering, is it possible to write a solution to the following problem with the following criteria: 1. it must be as efficient as possible at run-time 2. be in O(1) 3. and...
0
by: tienlx | last post by:
Hi, I've a report (ReportAppointment.rdlc) in ASP.NET When viewing reports, the vertical distance between the two group are too big. I've tried to reduce the vertical distances but i can't. Demo:...
16
by: Martin Jørgensen | last post by:
Hi, Problem: ======== Some of my output functions are beginning to take pretty many arguments... I mean.... We're talking about 10-15 arguments :-) So I thought to myself, perhaps this is...
3
by: Paul Aspinall | last post by:
Hi Can anyone recommend a suitable way of calculating distances between UK post codes?? Many websites do this, and I'm wondering if there is some standard code, and where the reference DB comes...
19
by: jsanshef | last post by:
Hi, after a couple of days of script debugging, I kind of found that some assumptions I was doing about the memory complexity of my classes are not true. I decided to do a simple script to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.