# Calculating the distance between 2 GPS Cordinates – Follow on

In a previous post, I discussed calculating distances based on GPS coordinates, subsequently I came across a good python library that offers this functionality as well as a lot more. I decided that anybody that is interested in the distance calculation via GPS coordinates will probably appreciate everything else that the GeoPy library has to offer.

In addition to the distance calculation, GeoPy offers a client functionality to access several popular geocoding web servers.

From the Readme file of the package’s GitHub site:

geopy makes it easy for Python developers to locate the coordinates of addresses, cities, countries, and landmarks across the globe using third-party geocoders and other data sources.

geopy includes geocoder classes for the OpenStreetMap NominatimGoogle Geocoding API (V3), and many other geocoding services.

Here is my previous example coded with the GeoPY library

``````from geopy.distance import great_circle
Dublin = (53.35, -6.27)
SanFrancisco=(37.78, -122.42)

great_cicle_dis = great_circle(Dublin, San Francisco).kilometers
geodesic_dis = geodesic(Dublin, San Francisco).kilometers

Cities = { 'Vancouver':(49.25,-123.1),
'Portland':(45.52,-122.68),
'San Francisco':(37.78, -122.42),
'Seattle':(47.62, -122.33),
'San Antonio':(29.42, -98.5),
'Dallas':(32.78,-96.8),
'Austin':(30.25,-97.75),
'Dublin':(53.35, -6.27),
'Sevilla':(37.38, -5.98),
'Belfast':(54.6,-5.93),
'Sydney':(-33.87, 151.22),
'Canberra':(-35.3, 149.12),
'Tokyo':(35.68, 139.7)}

import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph()
Cnames = ['Vancouver', 'Portland', 'San Francisco', 'Seattle',
'San Antonio', 'Dallas', 'Austin', 'Sevilla',
'Belfast', 'Sydney', 'Canberra', 'Tokyo']
nodes = []
for name in Cnames:
nodes.append(name)