
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Calculating distance using Latitude and Longitude
Hi All
I have a set of recorde where, i want to calculate the distance using latitude and longitude.
employeid | name | state | District | Latitude | Longitude |
1 | john | asd | newyork | 22.37 | 114.12 |
2 | ricky | adsd | carolina | 22.36 | 114.13 |
3 | patrik | affdf | WDC | 22.32 | 114.21 |
4 | micheal | agffsf | London | 22.32 | 114.16 |
5 | harry | addsdsdfs | Hong Kong | 22.28 | 114.18 |
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No your result isn´t correct, see attached qvw file!
The distance is set to kilometers. You can check this with online tools like:
nhc.noaa.gov/gccalc.shtml

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
not sure which distances you need to calculate but johnw posted a very nice approach here:
Haversine formula to find distance between two lat/long points
hope this helps!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this is my requirement exatly
I have a data as below
Tanle1
Employee latitude longitude
Arnold 121 130
Beck 150 72
Table 2
Factory f_latitude f_longitude
A 211.7 179.5
B 129 150
I want to calculate the distance from Arnold to both the factories A and B
the distance from Beck to both the factories A and B
Is it possible to do and there is no relation between the two tables

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
are you sure about the latitude values because latitude cannot exceed 90 degrees!
I adapted the above mentioned qvw with random latitude values!
hope this helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah the values are wrong my assumed values and if i have 50 employees and 50 Factories can we get all the distances between all employess to all the factories

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, see above posted qvw!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Frank,
I have the data as follows
emp-tab:
emp_id, lat1, long1
1, 22.32, 114.17
2, 22.28, 114.16
factory_tab:
Fact_ID, lat2, long2
1, 22.42544, 114.23134
2, 22.29540, 114.26860
i'm getting the end results as
is this correct and what format is this distance in is it miles

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No your result isn´t correct, see attached qvw file!
The distance is set to kilometers. You can check this with online tools like:
nhc.noaa.gov/gccalc.shtml

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Frnak, i have two different tables in my senario
can't we achieve if the the dat is in two different tables

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Frank i got it, i forget to do this calculation *pi()/180
in the second table

- « Previous Replies
-
- 1
- 2
- Next Replies »