Find distance between two cities in Excel using Google Maps API -
I want a table of the following form:
point one point B mileage Los Angeles Miami 292100 Palo Alto San Francisco 90
I was hoping to use Google Maps or some other Geogebi API to generate profit based on Dynamically Input Cities. Any ideas about doing this?
UPDATE It looks like I can use the GDirections
in the getDistance ()
function. I could write javascript for no difficulty, but how do I include it in Excel?
I can put JS in an html file that takes the query string and gives the distance of the route. After that, I could set up Excel to use that connection. Or is it an excessive amount of work? And it has not been done like that before?
So, you can have Google's latitude and longitude for each point (in your case , You want any point in those cities) After this you can use the Halssein distance formula:
For VBA, I have this function in my library which I have got from somewhere. At first glance, it looks correct and it produces distance in kilometers (just by converting it into a mile for its purpose). Public Function HaversineDistance (double as Light 1, Double Double as Byval Lat2 Double, _ ByVal Long1 double, _ ByVal Long2 Double) Double integer R as integer ============================================================================================ 6371 'double double as Deltaaal in the form of the radius of the double' double as double double in the form of double deltaaal, Double error in double form as Double Double P error error as pie, PI = 4 * ATN (1) 'Lat1, Lat2, Long1, PI / 180Let2 = Late 2 * Pi / 180 Long1 = Long 1 * Pi / 180 Lo in three-latitude Ng2 = Long 2 * Pi / 180 'Calculate the change in latitude and delineation DeltaLat = Abs (Lat2 - Lat1) DeltaLong = Abs (Long2 - Long1) a = ((Seine (DeltaAlete / 2)) 2) + (Kos ( Wave 1) * Cos (wave 2) * ((Seen (Delta Long / 2)) 2)) 'C = 2 * App Worksheet Function. Aetan 2 (SKR (A), SKR (1 - A)) is expressed as' radian C = 2 * application. Worksheet Function. Etan ((SKR (1 - A)) / (SKR (A)) / (SCR (A))) Harvesten Application = R * C Erridge and Function
(note to other commentator) Do not tell me, I do not have any interest in hearing that accuracy is unnecessary!)
Comments
Post a Comment