473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Advanced post code matching

I am planning an Access database for a Hotel chain with several hotels
all over the UK. The required functionality is as follows:

1. A client wants to know the nearest hotel/s to a specific location.

2. The db user keys in the client's postcode and the system returns
the three hotels nearest to them in a format similar to the following:

Distance form Postcode Hotel Name Location Tel
5.5 miles The Royal Bristol
01555 5551
123 miles The Regent London 0207
557 5555
125 miles The Plaza London
0207 667 4444

Does any one know of a third party tool that will do this? All I need
is the bit that can take all of the Hotel postcodes (about 30) and
calculate the distance of each of them to the user entered postcode. I
can do the rest.

Thanks,

Paul
Nov 12 '08 #1
13 3958
co**********@googlemail.com wrote:
I am planning an Access database for a Hotel chain with several hotels
all over the UK. The required functionality is as follows:

1. A client wants to know the nearest hotel/s to a specific location.

2. The db user keys in the client's postcode and the system returns
the three hotels nearest to them in a format similar to the following:

Distance form Postcode Hotel Name Location Tel
5.5 miles The Royal Bristol
01555 5551
123 miles The Regent London 0207
557 5555
125 miles The Plaza London
0207 667 4444

Does any one know of a third party tool that will do this? All I need
is the bit that can take all of the Hotel postcodes (about 30) and
calculate the distance of each of them to the user entered postcode. I
can do the rest.

Thanks,

Paul
Wouldn't it be easier to pass the selection to GoogleMaps for hotels in
that area?

Nov 12 '08 #2
On 12 Nov, 16:35, Salad <o...@vinegar.comwrote:
comcraft1...@googlemail.com wrote:
I am planning an Access database for a Hotel chain with several hotels
all over the UK. The required functionality is as follows:
1. A client wants to know the nearest hotel/s to a specific location.
2. The db user keys in the client's postcode and the system returns
the three hotels nearest to them in a format similar to the following:
Distance form Postcode * *Hotel Name * * *Location * * *Tel
5.5 miles * * * * * * * * * * * * The Royal ** * * Bristol
01555 5551
123 miles * * * * * * * * * * * * The Regent * * *London * * * * *0207
557 5555
125 miles * * * * * * * * * * * * The Plaza ** * *London
0207 667 4444
Does any one know of a third party tool that will do this? All I need
is the bit that can take all of the Hotel postcodes (about 30) and
calculate the distance of each of them to the user entered postcode. I
can do the rest.
Thanks,
Paul

Wouldn't it be easier to pass the selection to GoogleMaps for hotels in
that area?
Thanks for your reply.

No that would not work; the Access database stores a list of the 30
hotels owned by this hotel chain.
I am trying to find the best three matches amongst those hotels to a
user entered postcode.

Paul
Nov 13 '08 #3
Hi there,

I am not aware of a third party tool except for google maps and the
associated api. The issue you face is one of knowing the distance
between postcodes, and you dont have a reference with that data to
work with.

As I see it there are really only two ways to achieve this, either do
what Salad has suggested and let google maps do the calculation for
you, or, find a database / create a table that has the various suburbs
and postcodes along with their geographic (GPS type data) location and
do the distance calculations yourself in the app.

Either way, you are going to have to find a geographic starting point
(the customers point of origin) and a 'nearest' destination point (the
hotel) by calculating the distance between the starting point and each
destination and choosing the shortest, maybe rank them or something
like that. The point is YOU NEED THE GEOGRAPHIC DATA.

Hope this helps

Cheers

The Frog
Nov 14 '08 #4
Have a look ar http://www.easypeasy.com/guides/article.php?article=64

That appears to be post codes to Lat & Longitude. Some maths should give you
the distance (AS THE CROW FLIES) to your hotels. Obviously you would need to
store both the Post code to Lat & Long data and the Lat & Long of each hotel

HTH

Phil
"The Frog" <Mr************@googlemail.comwrote in message
news:9b**********************************@w39g2000 prb.googlegroups.com...
Hi there,

I am not aware of a third party tool except for google maps and the
associated api. The issue you face is one of knowing the distance
between postcodes, and you dont have a reference with that data to
work with.

As I see it there are really only two ways to achieve this, either do
what Salad has suggested and let google maps do the calculation for
you, or, find a database / create a table that has the various suburbs
and postcodes along with their geographic (GPS type data) location and
do the distance calculations yourself in the app.

Either way, you are going to have to find a geographic starting point
(the customers point of origin) and a 'nearest' destination point (the
hotel) by calculating the distance between the starting point and each
destination and choosing the shortest, maybe rank them or something
like that. The point is YOU NEED THE GEOGRAPHIC DATA.

Hope this helps

Cheers

The Frog

Nov 14 '08 #5
Hi,

Phil Stanton wrote:
That appears to be post codes to Lat & Longitude. Some maths should
give you the distance (AS THE CROW FLIES) to your hotels.
Think the neat code sample database contains some useful functions :

http://support.microsoft.com/kb/177972/en-us
Regards
Jens
Nov 14 '08 #6
The Frog wrote:
Hi there,

I am not aware of a third party tool except for google maps and the
associated api. The issue you face is one of knowing the distance
between postcodes, and you dont have a reference with that data to
work with.

As I see it there are really only two ways to achieve this, either do
what Salad has suggested and let google maps do the calculation for
you, or, find a database / create a table that has the various suburbs
and postcodes along with their geographic (GPS type data) location and
do the distance calculations yourself in the app.

Either way, you are going to have to find a geographic starting point
(the customers point of origin) and a 'nearest' destination point (the
hotel) by calculating the distance between the starting point and each
destination and choosing the shortest, maybe rank them or something
like that. The point is YOU NEED THE GEOGRAPHIC DATA.

Hope this helps

Cheers

The Frog
Hi Frog:

I don't know but perhaps he could use some mapping/GPS type software to
return the results. I was at a company years ago and they had the
longitude/latitudes entered into the app and calculated distances from
that. However, there was a problem that the distance between ptA and
ptB may be short...but a lake or canal might be in the way and getting
around that would be too long.

Using my method of Google, he might get Hotels not in his chain. I'm
wondering if he could pass the hotels in the chain and have them come up
with pincushions of those locations.

I entered "San Francisco Hotels Hilton Sheraton" and got a list of 8
hotels. The OP could pass something like that string to GoogleMaps to
limit the list.
Nov 14 '08 #7
Have you investigated Microsoft's Map Point? I have colleagues who used it
for "things geographic", but don't know if it will do what you want... but I
would suspect that it can.

Larry Linson
Microsoft Office Access MVP
<co**********@googlemail.comwrote in message
news:e6**********************************@w1g2000p rk.googlegroups.com...
>I am planning an Access database for a Hotel chain with several hotels
all over the UK. The required functionality is as follows:

1. A client wants to know the nearest hotel/s to a specific location.

2. The db user keys in the client's postcode and the system returns
the three hotels nearest to them in a format similar to the following:

Distance form Postcode Hotel Name Location Tel
5.5 miles The Royal Bristol
01555 5551
123 miles The Regent London 0207
557 5555
125 miles The Plaza London
0207 667 4444

Does any one know of a third party tool that will do this? All I need
is the bit that can take all of the Hotel postcodes (about 30) and
calculate the distance of each of them to the user entered postcode. I
can do the rest.

Thanks,

Paul

Nov 15 '08 #8
A Google search of "PostCode Latitude" brings up at least one
reference to a publicly available file of the coordinates of areas
associated with UK Postal Codes. One could use these to calculate in-
line distances with code like this:

Const PI# = 3.14159265358979
' circumference in kilometers
Const Circumference# = 40123.648

Public Function GreatCircleDistance#( _
ByVal Latitude0#, ByVal Longitude0#, _
ByVal Latitude1#, ByVal Longitude1#)

On Error Resume Next

Dim Arc#
Dim CosArc#

If Latitude0 = Latitude1 And Longitude0 = Longitude1 Then
GreatCircleDistance = 0
Else
Latitude0 = Radians(Latitude0)
Longitude0 = Radians(Longitude0)
Latitude1 = Radians(Latitude1)
Longitude1 = Radians(Longitude1)
CosArc = (Sin(Latitude0) * Sin(Latitude1)) + _
(Cos(Latitude0) * Cos(Latitude1) * Cos(Longitude0 -
Longitude1))
Arc = Degrees(Atn(-CosArc / Sqr(-CosArc * CosArc + 1)) + 2 *
Atn(1))
GreatCircleDistance = Arc / 360 * Circumference
End If
End Function

Private Function Radians#(ByVal Degrees#)
Radians = PI * Degrees / 180
End Function

Private Function Degrees#(ByVal Radians#)
Degrees = Radians / PI * 180
End Function

On Nov 12, 11:26*am, comcraft1...@googlemail.com wrote:
I am planning an Access database for a Hotel chain with several hotels
all over the UK. The required functionality is as follows:

1. A client wants to know the nearest hotel/s to a specific location.

2. The db user keys in the client's postcode and the system returns
the three hotels nearest to them in a format similar to the following:

Distance form Postcode * *Hotel Name * * *Location * * *Tel
5.5 miles * * * * * * * * * * * * The Royal * * * * Bristol
01555 5551
123 miles * * * * * * * * * * * * The Regent * * *London * * * * *0207
557 5555
125 miles * * * * * * * * * * * * The Plaza * * * *London
0207 667 4444

Does any one know of a third party tool that will do this? All I need
is the bit that can take all of the Hotel postcodes (about 30) and
calculate the distance of each of them to the user entered postcode. I
can do the rest.

Thanks,

Paul
Nov 15 '08 #9
On Nov 15, 6:14 am, lyle fairfield <lyle.fairfi...@gmail.comwrote:
A Google search of "PostCode Latitude" brings up at least one
reference to a publicly available file of the coordinates of areas
associated with UK Postal Codes. One could use these to calculate in-
line distances with code like this:

Const PI# = 3.14159265358979
' circumference in kilometers
Const Circumference# = 40123.648

Public Function GreatCircleDistance#( _
ByVal Latitude0#, ByVal Longitude0#, _
ByVal Latitude1#, ByVal Longitude1#)

On Error Resume Next

Dim Arc#
Dim CosArc#

If Latitude0 = Latitude1 And Longitude0 = Longitude1 Then
GreatCircleDistance = 0
Else
Latitude0 = Radians(Latitude0)
Longitude0 = Radians(Longitude0)
Latitude1 = Radians(Latitude1)
Longitude1 = Radians(Longitude1)
CosArc = (Sin(Latitude0) * Sin(Latitude1)) + _
(Cos(Latitude0) * Cos(Latitude1) * Cos(Longitude0 -
Longitude1))
Arc = Degrees(Atn(-CosArc / Sqr(-CosArc * CosArc + 1)) + 2 *
Atn(1))
GreatCircleDistance = Arc / 360 * Circumference
End If
End Function

Private Function Radians#(ByVal Degrees#)
Radians = PI * Degrees / 180
End Function

Private Function Degrees#(ByVal Radians#)
Degrees = Radians / PI * 180
End Function
In:

http://groups.google.com/group/micro...baa12e5809aa90

I derived a formula for the great circle distance between two points
given their latitude and longitude coordinates. I also proved that it
is correct, although some mathematical simplification should be done
for comparison with other formulae. Of course, if you're not aware
that the dot product of two unit vectors gives the cosine of the angle
between them, then the simple proof is not as obvious :-). I have a
lot more confidence in the formulae that I can derive or show to be
equivalent to what I derive. Then when there's a difference I can
determine what assumptions or simplifications were made.

James A. Fortune
CD********@FortuneJames.com
Nov 16 '08 #10
On Sat, 15 Nov 2008 16:01:53 -0800 (PST), CD********@FortuneJames.com wrote:
>On Nov 15, 6:14 am, lyle fairfield <lyle.fairfi...@gmail.comwrote:
>A Google search of "PostCode Latitude" brings up at least one
reference to a publicly available file of the coordinates of areas
associated with UK Postal Codes. One could use these to calculate in-
line distances with code like this:

Const PI# = 3.14159265358979
' circumference in kilometers
Const Circumference# = 40123.648

Public Function GreatCircleDistance#( _
ByVal Latitude0#, ByVal Longitude0#, _
ByVal Latitude1#, ByVal Longitude1#)

On Error Resume Next

Dim Arc#
Dim CosArc#

If Latitude0 = Latitude1 And Longitude0 = Longitude1 Then
GreatCircleDistance = 0
Else
Latitude0 = Radians(Latitude0)
Longitude0 = Radians(Longitude0)
Latitude1 = Radians(Latitude1)
Longitude1 = Radians(Longitude1)
CosArc = (Sin(Latitude0) * Sin(Latitude1)) + _
(Cos(Latitude0) * Cos(Latitude1) * Cos(Longitude0 -
Longitude1))
Arc = Degrees(Atn(-CosArc / Sqr(-CosArc * CosArc + 1)) + 2 *
Atn(1))
GreatCircleDistance = Arc / 360 * Circumference
End If
End Function

Private Function Radians#(ByVal Degrees#)
Radians = PI * Degrees / 180
End Function

Private Function Degrees#(ByVal Radians#)
Degrees = Radians / PI * 180
End Function

In:

http://groups.google.com/group/micro...baa12e5809aa90

I derived a formula for the great circle distance between two points
given their latitude and longitude coordinates. I also proved that it
is correct, although some mathematical simplification should be done
for comparison with other formulae. Of course, if you're not aware
that the dot product of two unit vectors gives the cosine of the angle
between them, then the simple proof is not as obvious :-). I have a
lot more confidence in the formulae that I can derive or show to be
equivalent to what I derive. Then when there's a difference I can
determine what assumptions or simplifications were made.

James A. Fortune
CD********@FortuneJames.com
The only assumptions in lyle's functions is that the earth is spherical and
that its diameter is 12771.753 KM - both of which, for all practical purposes
are true.

Chuck
--
Nov 16 '08 #11
Hi Everyone,

I was doing a little research on this and it appears that google maps
has a route calculator with shortest route capabilities. So, knowing
this function exists, and knowing that (from previous posts) there is
a list of postcodes with associated long / lat positions, AND knowing
the long / lat of the hotels themselves it SHOULD be possible to have
a user provide their postcode, then query google maps for the shortest
route to each hotel, then compare the results and provide user with a
ranked list of nearest to farthest.

The google maps API will be your friend here. As I understand it there
is an 'object' that can be defined for these purposes that is purely
HTML (ie/ text). You could potentially provide your users with a nice
little map with the route on it maybe!

Everybody wins :-)

@Lyle: Nice - I was looking for some great circle stuff for some time
but never got round to hunting for it. Thanks for putting it up.

@Salad: Have you had any success with software integration along these
lines? I have tried to 'play' with this stuff but not successfully. I
was looking at the google andriod OS, it seems to have the maps /
route planning stuff directly integrated - if you are looking for
software to work with along those lines maybe an Andriod VM?

Cheers

The Frog
Nov 17 '08 #12
The Frog wrote:
Hi Everyone,

I was doing a little research on this and it appears that google maps
has a route calculator with shortest route capabilities. So, knowing
this function exists, and knowing that (from previous posts) there is
a list of postcodes with associated long / lat positions, AND knowing
the long / lat of the hotels themselves it SHOULD be possible to have
a user provide their postcode, then query google maps for the shortest
route to each hotel, then compare the results and provide user with a
ranked list of nearest to farthest.

The google maps API will be your friend here. As I understand it there
is an 'object' that can be defined for these purposes that is purely
HTML (ie/ text). You could potentially provide your users with a nice
little map with the route on it maybe!

Everybody wins :-)

@Lyle: Nice - I was looking for some great circle stuff for some time
but never got round to hunting for it. Thanks for putting it up.

@Salad: Have you had any success with software integration along these
lines? I have tried to 'play' with this stuff but not successfully. I
was looking at the google andriod OS, it seems to have the maps /
route planning stuff directly integrated - if you are looking for
software to work with along those lines maybe an Andriod VM?
No. All I have is a presentation of a map or driving instructions for
an address. I thought that presenting Google maps seemed to be easiest
but your idea of the API would be better for the OP.
Cheers

The Frog
Nov 17 '08 #13
On Nov 16, 7:12 am, Chuck <libb...@schoollink.netwrote:
On Sat, 15 Nov 2008 16:01:53 -0800 (PST), CDMAPos...@FortuneJames.com wrote:
On Nov 15, 6:14 am, lyle fairfield <lyle.fairfi...@gmail.comwrote:
A Google search of "PostCode Latitude" brings up at least one
reference to a publicly available file of the coordinates of areas
associated with UK Postal Codes. One could use these to calculate in-
line distances with code like this:
Const PI# = 3.14159265358979
' circumference in kilometers
Const Circumference# = 40123.648
Public Function GreatCircleDistance#( _
ByVal Latitude0#, ByVal Longitude0#, _
ByVal Latitude1#, ByVal Longitude1#)
On Error Resume Next
Dim Arc#
Dim CosArc#
If Latitude0 = Latitude1 And Longitude0 = Longitude1 Then
GreatCircleDistance = 0
Else
Latitude0 = Radians(Latitude0)
Longitude0 = Radians(Longitude0)
Latitude1 = Radians(Latitude1)
Longitude1 = Radians(Longitude1)
CosArc = (Sin(Latitude0) * Sin(Latitude1)) + _
(Cos(Latitude0) * Cos(Latitude1) * Cos(Longitude0 -
Longitude1))
Arc = Degrees(Atn(-CosArc / Sqr(-CosArc * CosArc + 1)) + 2 *
Atn(1))
GreatCircleDistance = Arc / 360 * Circumference
End If
End Function
Private Function Radians#(ByVal Degrees#)
Radians = PI * Degrees / 180
End Function
Private Function Degrees#(ByVal Radians#)
Degrees = Radians / PI * 180
End Function
In:
http://groups.google.com/group/micro...browse_frm/thr...
I derived a formula for the great circle distance between two points
given their latitude and longitude coordinates. I also proved that it
is correct, although some mathematical simplification should be done
for comparison with other formulae. Of course, if you're not aware
that the dot product of two unit vectors gives the cosine of the angle
between them, then the simple proof is not as obvious :-). I have a
lot more confidence in the formulae that I can derive or show to be
equivalent to what I derive. Then when there's a difference I can
determine what assumptions or simplifications were made.
James A. Fortune
CDMAPos...@FortuneJames.com

The only assumptions in lyle's functions is that the earth is spherical and
that its diameter is 12771.753 KM - both of which, for all practical purposes
are true.

Chuck
--

I agree since his formula is exactly equivalent to mine once the
cosine of a sum trig identity is applied. My point remains whether
there is a difference in the formulae or not. It is interesting to
note that for a much tougher calculation involving the sun's position
in the sky for any latitude and longitude at a given time, one of the
two angles turned out to be the arccosine of a product of cosine
terms. That derivation used vector dot and cross products to get the
solution and the formula was fairly accurate in spite of the fact that
it assumed a circular orbit of the earth about the sun. Having a
closed-form solution was a nice plus. You could get approximate
sunrise and sunset times by solving for when the vertical angle is
zero, plus you could find the different sunrise and sunset azimuth
angles as they change throughout the year. I believe that in
Australia the sun swings into the northern sky (year round once the
latitude is greater than the tilt of the Earth's axis).

James A. Fortune
CD********@FortuneJames.com

In the absence of daylight savings time, if your time zone is not too
irregular your actual solar noon can be up to about half an hour
before or after nominal noon depending on how far East or West you are
of the center of your time zone.
Nov 20 '08 #14

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

Similar topics

7
by: nortelsale | last post by:
I know nothing about programming but I am building a website (written with php) that allow people post some info. Is there a site I can get some templates or php scripts for an advanced search...
9
by: james | last post by:
please excuse my ignorance of Python. i know enough to be dangerous (was able however to make Freevo support my FM tuner with a little hacking). Ultimate goal: read N bytes from PATTERN on page...
2
by: Mike Sweetman | last post by:
I have a form Form1 which when the Advanced Filter/Sort is used creates a form(maybe) with a title 'Form1Filter1 : Filter'. When I apply the filter to Form1 it is applied, but the value of...
1
by: lukwagoroy | last post by:
Loaded 'ntdll.dll', no matching symbolic information found. I'm writing a small program. It compiled and run. But when trying to debug by select, I got the following error messages: Loaded...
4
by: z. f. | last post by:
Hi, i stated that this is an advanced question because i have a post from few days ago that i received answers to with suggestions that looked good but did not work, so please if you post a...
2
by: HotRod | last post by:
I know I've asked a question like this before but I can't remember what the final verdict was. When I use to program in VB I could fill a recordset with the names of cities and then start filtering...
43
by: Woodies_46 | last post by:
Hi all, I'm just a little bit stuck... what i have is a form with tick boxs and text boxs and stuff like that on it and a search button. What I would like to be able to do is for the user to...
2
by: Bernard Liang | last post by:
In response, I have another question about the scanf family. After reading in a %d value, for instance, do they immediately wade through all subsequent whitespace until a non-whitespace character...
1
by: Critical Skills, Inc. | last post by:
Oracle Advanced Benefits Analyst / Lead Start: 08/15/2004 End: 03/01/2005 Pay Rate: $80 - $85 per hour Job Duties: Must be open to travel. Must have designed and implemented...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.