Answered by:
Distance between two postcodes
Question

I am working on UK map postcodes.
Every postcode has their MapX and MapY coordinates.I am using MapPoint to caliculate the distance between two postcodes
I have doubt like
If the difference between MapX betwen two postcodes and the
difference between MapY between two postcodes lessthan 1500 then the distance between two postcodes is lessthan
11 miles.for example
POSTCODE MAPX MAPY
BL2 1BP 37190 40890
BL2 1DU 37210 40830The difference between Mapx is 20
The difference between Mapy is 60and the distance between there postcodes 0.5 miles
I done few caliculation on few postcodes MapX and MapY , it looks fine for me.
Does this works really on every postcode MapX and MapY
Any idea pleaseMonday, May 14, 2007 10:17 AM
Answers

I'm assuming your using the Mappoint Web Service?
The best way is to add up your itinerary time and distances using MWS, as it will give you exactly the numbers you need. If not then again the only choice I see is to use a distance formula between two lat/longs and also assume some set speed to get your time. This alternative is quick since the request doesn't need to be sent up to MWS but you'll definately lose accuracy.
On another note, this forum is suppose to be for Virtual Earth related questions, so please post up any further issues on the appropriate newsgroups at:
Mappoint Web Service
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.mappoint.webservice&lang=en&cr=US
Mappoint Desktop
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.mappoint&lang=en&cr=US Marked as answer by Ricky_BrundrittModerator Saturday, November 28, 2009 12:54 PM
Monday, May 14, 2007 2:11 PM
All replies

Calculating distance between postcodes can easily be achieved using Pythagoras' Theorem.
In a rightangled triangle the square of the hypotenuse is equal to the sum of the squares of the other two sides.
So, the square of a (a²) plus the square of b (b²) is equal to the square of c (c²):
a2 + b2 = c2
Please note a fivefigure grid reference as used by PAF is accurate to 10M. (For 1M accuracy just add a zero) The postcode grid reference can be out by up to 500M or more, particularly in rural areas, as the postcode in some rural locations is for the village green, pub etc and the house/houses can be some distance away from that point.
Please note Pythagoras' Theorem is not suitable for calculating distance using Latitude and Longitude!
Monday, May 14, 2007 1:46 PM 
I'm not too sure if that simply measuring out the pixel coordinate differences to get your distance will work (because the world is round but flattened due to mercuator projection), but there's another method that most people use at the moment.
Basically calculate the lat/longs for postal code A and B, then use a mathematical formula to calculate the distance between two lat/longs:
You'd looking for something like this:
http://www.cs.cmu.edu/~mws/lld.html
Hope that helps,Monday, May 14, 2007 1:48 PM 
Hi thanks for the replies.
I am using MapPoint to caliculate distance and driving time between two points.
Because i need to caliculate the time as well.That's why i am using Map point in my program.
But mappoint using lot of time to caliculate the distance and Time using Mappoint.
So i am trying to reduce the time.
Actually my problem is i am trying to caliculate the postcodes within 10 miles of the given postcode.
Any idea please
Monday, May 14, 2007 2:05 PM 
I'm assuming your using the Mappoint Web Service?
The best way is to add up your itinerary time and distances using MWS, as it will give you exactly the numbers you need. If not then again the only choice I see is to use a distance formula between two lat/longs and also assume some set speed to get your time. This alternative is quick since the request doesn't need to be sent up to MWS but you'll definately lose accuracy.
On another note, this forum is suppose to be for Virtual Earth related questions, so please post up any further issues on the appropriate newsgroups at:
Mappoint Web Service
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.mappoint.webservice&lang=en&cr=US
Mappoint Desktop
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.mappoint&lang=en&cr=US Marked as answer by Ricky_BrundrittModerator Saturday, November 28, 2009 12:54 PM
Monday, May 14, 2007 2:11 PM 
The problem I would have thought regarding speed is the time it takes for the round trip to the Map Point server, particularly if multiple postcodes are being used. For speed it would be better to write your own algorithm in JavaScript or sever side code for calculating both distance and time.
Monday, May 14, 2007 2:19 PM 
Thanks for the advice.
I will try to get the solution using these advices.
If not i will post this question in other group.
Thank you
Monday, May 14, 2007 3:32 PM