aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/python
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2018-03-22 11:54:28 +0100
committerGravatar Jan Tattermusch <jtattermusch@google.com>2018-03-23 07:44:30 +0100
commita26aecc03b5c110ce0912f3340933a4ed87d5ec0 (patch)
treefd54656fc841298d4f8908972f8c4ce62396c30a /examples/python
parentb4a5727149201bac53a33c53c2cf93fed5414540 (diff)
reimplement distance calculation in routeguide
Diffstat (limited to 'examples/python')
-rw-r--r--examples/python/route_guide/route_guide_server.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/examples/python/route_guide/route_guide_server.py b/examples/python/route_guide/route_guide_server.py
index f10008fdec..1969fdd378 100644
--- a/examples/python/route_guide/route_guide_server.py
+++ b/examples/python/route_guide/route_guide_server.py
@@ -46,6 +46,7 @@ def get_distance(start, end):
delta_lat_rad = math.radians(lat_2 - lat_1)
delta_lon_rad = math.radians(lon_2 - lon_1)
+ # Formula is based on http://mathforum.org/library/drmath/view/51879.html
a = (pow(math.sin(delta_lat_rad / 2), 2) +
(math.cos(lat_rad_1) * math.cos(lat_rad_2) * pow(
math.sin(delta_lon_rad / 2), 2)))