Skip to content

Instantly share code, notes, and snippets.

@dill
Last active January 5, 2018 13:18
Show Gist options
  • Save dill/a65cda652dbf103c4f2b343e7946874a to your computer and use it in GitHub Desktop.
Save dill/a65cda652dbf103c4f2b343e7946874a to your computer and use it in GitHub Desktop.
How far did I travel in 2017?
# how far did I go in 2017?
# read in the list of places I went to
txt <- readLines("howfar2017.txt")
# decode the place names to lat/long
library(ggmap)
gg <- geocode(txt, source="dsk")
# using:
# https://flowingdata.com/2011/05/11/how-to-map-connections-with-great-circles/
library(geosphere)
library(maps)
# background map
map("world", col="#f2f2f2", fill=TRUE, bg="white", lwd=0.05)
# add each of the (great circle) lines
for(i in 1:(nrow(gg)-1)){
inter <- gcIntermediate(gg[i, ], gg[i+1, ], n=50, addStartEnd=TRUE)
lines(inter, col="red")
}
Wast Water, Cumbria, UK
Sunderland, UK
Keswick, UK
St Andrews, UK
London, UK
Woods Hole, MA, USA
Ames, IA, USA
Woods Hole, MA, USA
Amherst, MA, USA
London, UK
St Andrews, UK
London, UK
Woods Hole, MA, USA
Cambridge, MA, USA
Boston, MA, USA
Keflavik, Iceland
Zurich, Switzerland
Bled, Slovenia
Trieste, Italy
Cambridge, UK
London, UK
Wakefield, UK
Richmond, Yorkshire, UK
Sunderland, UK
London, UK
Dubai
Sydney, Australia
Hobart, Australia
Melbourne, Australia
Hobart, Australia
Melbourne, Australia
Dubai
London, UK
Sunderland, UK
St Andrews, UK
York, UK
St Andrews, UK
London, UK
Reykjavik, Iceland
St Andrews, UK
Sunderland, UK
London, UK
Bergen, Norway
London, UK
York, UK
St Andrews, UK
Providence, RI, USA
St Andrews, UK
Penrith, UK
St Andrews, UK
Edinburgh, UK
Dublin, Ireland
Boston, MA, USA
Halifax, Canada
Boston, MA, USA
Keflavik, Iceland
London, UK
St Andrews, UK
London, UK
Seattle, WA, USA
London, UK
Dundee, UK
Sheffield, UK
London, UK
Dundee, UK
Sunderland, UK
London, UK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment