Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
library(geosphere)
library(sp)
data("meuse")
library(RgoogleMaps)
getGeoCode("Frankfurt, Germany")
# lat lon
#50.110922 8.682127
LA <- c(-118.40, 33.95)
FRA = c(8.682127, 50.110922)
data(wrld)
plot(wrld, type='l', main= "FRA -> LAX")
lines(c(FRA[1],LA[1]), c(FRA[2],LA[2]), col = 2, lwd=2)
gc2 <- greatCircle(FRA, LA)
lines(gc2, lwd=2, col='blue')
cat("The geodesic distance between LA and FRA is ",
distHaversine(LA,FRA)/1000,"km \n")
#### Plot and compute the great circle distance between Sydney and Darmstadt
# If you want to read more about the efficient use of Quadkeys:
# https://msdn.microsoft.com/en-us/library/bb259689.aspx
#There are various map tile servers
# http://mt1.google.com/vt/lyrs=m&x=8799&y=5375&z=14
# http://a.tile.openstreetmap.org/14/8799/5375.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment