Skip to content

Instantly share code, notes, and snippets.

@markusloecher
Created November 26, 2017 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markusloecher/2b0c07e688116daf3ac3d80fad227412 to your computer and use it in GitHub Desktop.
Save markusloecher/2b0c07e688116daf3ac3d80fad227412 to your computer and use it in GitHub Desktop.
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