Latitudinal & Longitudinal Accuracy for Navigatable Distances (API/PowerBI/Tableau)

zgoldflo

New Member
Joined
Dec 13, 2021
Messages
30
Office Version
  1. 365
Platform
  1. Windows
To convert latitudinal and longitudinal coordinates into miles first you must convert those coordinates into radians for excel. That can be done in two ways. Input the =RADIANS() function to your latitudinal and longitudinal values. Or by using the formula =(Value)/180)*PI(). Once successfully converting coordinates into radians. I found two formulas (with the help of @kweaver ) to convert those coordinates into miles. Ensure your cells are in the correct data type format to prevent error messages and incorrect outputs.

The first formula I found was from here and had the following sequence =3443.8985*(ACOS(SIN(N2)*SIN(R2)+COS(N2)*COS(R2)*COS(S2-O2))). I believe this formula solves for nautical miles which is longer than the traditional mile.

1.1.png



The second formula I found here (thanks @kweaver !) and could be retrieved by downloading the spreadsheet. I believe the second formula solves for the radius of the earth in miles =3958.82*((2*ASIN(SQRT((SIN((N2-R2)/2)^2)+COS(N2)*COS(R2)*(SIN((O2-S2)/2)^2))))). This seems to be more accurate to the traditional mile.

1.2.png


As you can see, there is a slight difference between the two formulas.

1.3.png



To be clear, if you are looking for the distance in populated areas with buildings and roads to navigate, this calculation will be even further from accurate. For example:


1.4.png


The image above shows the distance between two stations, displaying both the direct distance (roughly 570.14m or 0.354 mi) and navigatable distance (0.5mi). Considering it would be impossible to navigate your bicycle through buildings, the practical route along navigatable roads is longer.

Even if we would compare the direct distance (0.354mi) results given by Google Maps and then compare them to the results received by the output of our two formulas there is also a slight difference. With the nautical mile formula output of 0.327mi and traditional mile output of 0.376mi. As you can see, there are still slight differences between both results. However, when comparing the actual navigatable distance (0.5mi), there is an even larger discrepancy which could definitely skew results.

With (hundreds of) thousands of rows of data, I don't know if it would be possible to 'add-in' some sort of Google API that could measure the practical navigatable distance between the two points by using, for example, street names. Furthermore, with missing data (i.e. no street names) and only having the latitudinal and longitudinal coordinates, I don't know how it would be possible to have an API that would recognize the practical navigatable distance between two coordinates (i.e. navigating using available roads, not passing through buildings). Understandably, it would also depend on how accurate the coordinates are and whether those coordinates could attach to the most approximate address.

I did see a product by CDX Tech that seemed interesting and perhaps could solve this issue. Either way, I would like to find out what other options are out there. Let the hunt begin!

2021_divvy-tripdata.xlsx
HIJKLMNOPQRSTU
1start_station_nameend_station_namestart_station_idend_station_idstart_latstart_lngstart_lat_radiansstart_lng_radiansend_latend_lngend_lat_radiansend_long_radiansdistance_nautical_milesdistance_miles
241.79-87.590.729547627-1.52873389241.8-87.60.729547627-1.5289084250.4480860010.515082493
3Wentworth Ave & 63rd StKA150300002541.78-87.620.729198561-1.52925749141.78009517-87.62970850.729200222-1.5294269360.4351973090.500266724
4Larrabee St & Armitage AveSedgwick St & Webster AveTA13090000061319141.918084-87.6437490.731608582-1.52967198941.922167-87.6388880.731679844-1.5295871480.3278650230.37688643
5Wabash Ave & Adams StPeoria St & Jackson BlvdKA15030000151315841.879472-87.6256880.730934675-1.52935676541.8776416-87.649617790.730902729-1.5297744191.0765814831.237548758
6Clarendon Ave & Leland AveBroadway & Argyle StTA13070001191310841.967968-87.6500010.732479222-1.52978110741.973815-87.659660.732581271-1.5299496880.5566303940.63985612
7Clark St & Newport StLincoln Ave & Belmont Ave632TA130900004241.94447967-87.65478550.732069273-1.52986461241.93926267-87.66827150.731978219-1.5300999870.679617620.781232033
8Ellis Ave & 60th StKA150300001441.78514467-87.60106850.729288353-1.52892707441.78-87.620.729198561-1.5292574910.9031161511.038147403
941.72-87.620.728151364-1.52925749141.72-87.630.728151364-1.5294320240.4486449560.515725022
1041.79-87.60.729373094-1.52890842541.8-87.580.729547627-1.5285593591.079138151.240487688
11Wolcott (Ravenswood) Ave & Montrose AveClark St & Montrose AveTA1307000144KA150300002241.961406-87.6761690.732364693-1.53023782541.961588-87.6660360.73236787-1.530060970.4530315760.520767511
12Southport Ave & Irving Park RdSheridan Rd & Montrose AveTA1309000043TA130700010741.95417783-87.6642450.732238538-1.53002971241.96173933-87.654859330.732370511-1.5298659010.6185218290.711001379
1341.95-87.650.732165621-1.52978108941.95-87.650.732165621-1.5297810897.25747E-050
14Western Blvd & 48th Pl59441.80566533-87.683334170.729646506-1.5303628841.78-87.690.729198561-1.5304792211.5713312141.806272001
15Aberdeen St & Monroe StMorgan St & Polk St13156TA130700013041.880419-87.6555190.730951204-1.52987741441.871737-87.651030.730799674-1.5297990660.5591898060.642798209
16New St & Illinois StField Blvd & South Water StTA13060000131553441.890847-87.6186160.731133207-1.52923333541.88634906-87.617516550.731054703-1.5292141460.2747988430.315885953
17Clark St & Armitage AveLake Shore Dr & Wellington Ave13146TA130700004141.91832017-87.636297330.731612704-1.52954193341.936675-87.636863170.731933056-1.5295518081.1035508571.268550512
December_2020
Cell Formulas
RangeFormula
N2N2=R2
O2,N3:O17O2=RADIANS(M2)
R2:S17R2=(P2/180)*PI()
T2:T17T2=3443.8985*(ACOS(SIN(N2)*SIN(R2)+COS(N2)*COS(R2)*COS(S2-O2)))
U2:U17U2=3958.82*((2*ASIN(SQRT((SIN((N2-R2)/2)^2)+COS(N2)*COS(R2)*(SIN((O2-S2)/2)^2)))))
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Note: your equations for the great circle distance between two points in T2 and U2 are both approximations based on using a spherical model of the Earth. A closer approximation to the real earth shape is the spheriod which is a flattened sphere, thus the radius of the earth varies depending of how far from the equator you are. If you look at wikipedia it gives you the Earths radius of 3950 miles at the poles and 3963 miles at the Equator. So 3958.82 for the earth radius is correct somewhere on the earth but not in most places. Giving a figure which is accurate to 50 feet when in reality it varies by 13 miles implies an accuracy which doesn't exist!!
 
Upvote 0
Note: your equations for the great circle distance between two points in T2 and U2 are both approximations based on using a spherical model of the Earth. A closer approximation to the real earth shape is the spheriod which is a flattened sphere, thus the radius of the earth varies depending of how far from the equator you are. If you look at wikipedia it gives you the Earths radius of 3950 miles at the poles and 3963 miles at the Equator. So 3958.82 for the earth radius is correct somewhere on the earth but not in most places. Giving a figure which is accurate to 50 feet when in reality it varies by 13 miles implies an accuracy which doesn't exist!!
So you are saying that my number in U2 should be 3963 to get a more accurate measurement of up to 50 feet? For some reason, I highly doubt that. I also did see that Wikipedia page, but wasn't sure what would be more accurate. I saw you mentioned that the 'spheroid' would offer a closer approximation, is that the 3963 number? Either way, the comment above doesn't really address the crux of the issue. Which is what would be the most accurate manner to calculate longitudinal and latitudinal coordinates into navigable miles.
 
Last edited:
Upvote 0
So you are saying that my number in U2 should be 3963 to get a more accurate measurement of up to 50 feet?
No I am not saying that, The 50 feet comes from the fact that the number 3958.82 miles is accurate to 50 feet, i.e it is approximately 50 feet larger than 3958.81 .
Really I just wanted to point out that the calculations you are using for the spherical calculations in T2 and U2 are only approximations.
I have no idea how to work out the distance when trying to work out the navigable distance. I would suggest that probably the easest way of doing it it to write an interface to some on line tool that already has the facility to work out routes, e.g. google maps
 
Upvote 0
No I am not saying that, The 50 feet comes from the fact that the number 3958.82 miles is accurate to 50 feet, i.e it is approximately 50 feet larger than 3958.81 .
Really I just wanted to point out that the calculations you are using for the spherical calculations in T2 and U2 are only approximations.
I have no idea how to work out the distance when trying to work out the navigable distance. I would suggest that probably the easest way of doing it it to write an interface to some on line tool that already has the facility to work out routes, e.g. google maps
Hey again! Actually, what is awesome about my thread is that I actually included a tool (end of thread) that could be used for that purpose! Check out CDX Technologies and the products they have (free trial as well). My mind was personally blown and frankly, I was giddy with excitement that such a tool exists. In summary, the tool could be used exactly for the case scenario I was looking to solve for (and much more) - check out these YouTube videos detailing some of their available functionalities vid_1 & vid_2 (related to my case scenario).

Frankly, I would classify myself at best as 'beginner level' in excel. The above thread was my 'blind man' journey through trigonometric excel functions to solve for miles from lat/long coordinates. I had basically zero background knowledge. I want this post to serve as a valuable resource for excel users who are completely new to this concept. Honestly, I am terrible at math. If I was able to somehow figure this out (with help from the great and powerful @kweaver ) really anyone can do it with some persistence.

As you might have assumed, I did eventually realize that the distance in miles offered by the above functions was not exact and only offered an approximate distance at best. The new navigation term I learned was 'as the crow flies'. Meaning, the lat/long conversion into miles provided by the formulas above only could solve for the distance in a straight line i.e. 'from point (a) to point (b)' which would not take into consideration the actual navigable path. In comes CDX technologies to solve for that.

Thanks again for your comment!
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top