# Quickest method for determining which postcode is 2 miles north of original postcode? [duplicate]

What is the Quickest method for determining which postcode is 2 miles north of original postcode?

For instant L17.

I know how to determine the distance between 2 points as below, but the above formulae eludes me.

Code:

``````    public static final double PI = 3.14159265;
public static final double deg2radians = PI/180.0;

double lat1 = latitude1  * deg2radians;
double lat2 = latitude2  * deg2radians;
double lon1 = longitude1 * deg2radians;
double lon2 = longitude2 * deg2radians;

Math.cos(lat1)*Math.cos(lat2)*Math.pow(Math.sin((lon1-lon2)/2)
,2.0)));
``````

## marked as duplicate by whuber♦Mar 7 '14 at 14:51

• From what I understand, UK postcodes are not geometrically determined. – mkennedy Mar 6 '14 at 21:45
• That may be the case (which I don't know) but we can convert British postcodes into Longitude and latitudes which is how mapping software works – user27768 Mar 6 '14 at 21:46
• Oh, thank you. You're looking for either the geodesic 'forward' algorithm or its great circle equivalent. – mkennedy Mar 6 '14 at 21:50
• How do those work in relation to the above? Do you mind giving an example :-) thanks – user27768 Mar 6 '14 at 22:09
• Finally found a related gis.SE question: gis.stackexchange.com/questions/5821/… – mkennedy Mar 6 '14 at 22:43