I have asked similar question in the past but was not able to complate this task, but now I need to get back to it. I was able to find this page with the example of how to calculate the distance.
In my case this would be a STEP2
This seems to be the simplest method:
- Include this line in a header
[SIZE=13px]<script[/SIZE][SIZE=13px] [/SIZE][SIZE=13px]type[/SIZE][SIZE=13px]=[/SIZE][SIZE=13px]“text/javascript”[/SIZE][SIZE=13px] [/SIZE][SIZE=13px]src[/SIZE][SIZE=13px]=[/SIZE][SIZE=13px]“http://maps.google.com/maps/api/js?sensor=false&v=3&libraries=geometry”[/SIZE][SIZE=13px]></script> 2. Call this JS script to calculate
[/SIZE]
[SIZE=13px]google[/SIZE][SIZE=13px].[/SIZE][SIZE=13px]maps[/SIZE][SIZE=13px].[/SIZE][SIZE=13px]geometry[/SIZE][SIZE=13px].[/SIZE][SIZE=13px]spherical[/SIZE][SIZE=13px].[/SIZE][SIZE=13px]computeDistanceBetween [/SIZE][SIZE=13px]([/SIZE][SIZE=13px]latLngA[/SIZE][SIZE=13px],[/SIZE][SIZE=13px] latLngB[/SIZE][SIZE=13px]);[/SIZE]
[SIZE=13px]
then this
var loc1 = new GLatLng(52.5773139, 1.3712427); var loc2 = new GLatLng(52.4788314, 1.7577444); var dist = loc2.distanceFrom(loc1); alert(dist/1000);
to get the distance [/SIZE]
I need to complete STEP1 which is finding Lat/Long from the given address.
so variables loc1 and loc2 can be filled with appropriate values.