Advertisement
Guest User

Untitled

a guest
Apr 11th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. ###############################################################
  2. ####################### Assignment A6 #########################
  3. ####################################### Vivek Narang ##########
  4. # Start #
  5.  
  6. # Importing Required Libraries #
  7. library(ggplot2)
  8. library(ggmap)
  9. library(mapproj)
  10. library(DBI)
  11. library(RMySQL)
  12.  
  13. # Attempting to connect with the database wallaby.terry.uga.edu using credentials #
  14. conn <- dbConnect(RMySQL::MySQL(), "wallaby.terry.uga.edu", dbname="tesla", user="student", password="student")
  15. # Querying the tesla database to fetch the latitude and longitude of the locations in Norway #
  16. d <- dbGetQuery(conn,"SELECT y(location) AS lon, x(location) AS lat FROM superchargers WHERE country = 'Norway'")
  17. # Printing the lat/long data on console #
  18. d
  19. # Involking Google Maps API for fetching the map #
  20. map <- get_googlemap('Norway',marker=d,zoom=4)
  21. # Setting configuration parameters for this map #
  22. ggmap(map) + labs(x = 'Longitude', y = 'Latitude') + ggtitle('Norway offices')
  23. # End #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement