# Places in the Bible

After taking another look at Robert Rouse's github repo I noticed a very interesting dataset that I want to play with.

In [1]:
import math
import pandas as pd
from shapely.geometry import Point

CSV_DATA_ROOT = "https://raw.githubusercontent.com/souliberty/MetaV/master/CSV/"


Out[1]:
PlaceMarkID Latitude Longitude Label
0 1 0.00 0.00 Unknown Location
1 2 9.02 38.74 Seba
2 3 14.55 44.39 Sephar
3 4 15.35 44.21 Uzal
4 5 15.68 42.78 Raamah
5 6 21.95 31.34 Cush
6 7 22.00 77.00 Ophir
7 8 24.06 32.89 Syene
8 9 25.70 32.63 Thebes
9 10 26.62 37.91 Dedan
10 11 27.08 34.77 Red Sea
11 12 27.40 37.70 Kedar
12 13 27.63 38.55 Tema
13 14 28.32 30.69 Pathros
14 15 28.50 34.51 Dizahab
15 16 28.53 33.97 Sinai
16 17 28.73 33.84 Rephidim
17 18 28.77 33.40 Alush
18 19 28.83 33.42 Pelusium
19 20 28.85 34.85 Mesha

So what can we do with a CSV of Bible places with latitude and longitude? Map historical Bible distances from each other! Enter shapely.

The first thing we have to do is convert the latitude and longitudes to points. Let's start with 2 locations that still exist today so we can easily verify our calculations, Rome and the Adriatic Sea. Google maps tells us these 2 locations are roughly 201.21 miles apart. Let's see if we can calculate the same.

In [2]:
rome = places[places['Label'] == 'Rome']

# Now we need to turn these places into shapely points using latitude and longitude
rome_p = Point(float(rome['Latitude']), float(rome['Longitude']))

print(distance)

3.923289436174701


Well that doesn't look right. And it shouldn't as the distance function gives us the exact distance between the 2 points in POINTS not in miles which is what we want so let's keep cranking. To get the distance we're more familiar with (a great-circle distance) we'll need to use a slightly more complex formula. We'll be using the law of cosines I won't go into detail about the math but you can read about it on the Wikipedia.

In [3]:
distance_km = math.acos(math.sin(math.radians(rome_p.x)) * math.sin(math.radians(adriatic_sea_p.x)) +
# turn km into miles
distance = distance_km * 0.62

print("{0:.4f} km".format(distance_km))
print("{0:.4f} miles".format(distance))

325.6069 km
201.8763 miles


As you can see, we get pretty close to what I got on google (let's blame the bad data on my inability to click on the exact spot correctly). So now let's make it easier to look up these locations by putting this stuff in functions.

In [4]:
def find_distance(location1, location2):

place1 = places[places['Label'] == location1]
place2 = places[places['Label'] == location2]

# Now we need to turn these places into shapely points using latitude and longitude
place1_p = Point(float(place1['Latitude']), float(place1['Longitude']))
place2_p = Point(float(place2['Latitude']), float(place2['Longitude']))

distance = place2_p.distance(place1_p)

# turn km into miles
distance = distance_km * 0.62

print("{} is {:.2f} km and {:.2f} miles from {}".format(location1, distance_km, distance, location2))

find_distance('Seba', 'Uzal')
find_distance('Raamah', 'Sephar')
find_distance('Seba', 'Sephar')
find_distance('Raamah', 'Seba')
find_distance('Sinai', 'Pathros')

Seba is 921.13 km and 571.10 miles from Uzal
Raamah is 213.68 km and 132.48 miles from Sephar
Seba is 869.48 km and 539.08 miles from Sephar
Raamah is 860.67 km and 533.61 miles from Seba
Sinai is 321.59 km and 199.38 miles from Pathros


So that's working well. But what can we do with this stuff? Well I've gone ahead and purchased bibleplaces.org and over the coming weeks (time and 3 month old baby permitting) I will be building a small site that will let everyone figure out the distance between any 2 Bible locations and enhance your Bible reading by adding some context to those unknown forgotten places of the past. There will be a follow up blog post once the site is ready!