Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###############################################################
- ####################### Assignment A6 #########################
- ####################################### Vivek Narang ##########
- # Start #
- # Importing Required Libraries #
- library(ggplot2)
- library(ggmap)
- library(mapproj)
- library(DBI)
- library(RMySQL)
- # Attempting to connect with the database wallaby.terry.uga.edu using credentials #
- conn <- dbConnect(RMySQL::MySQL(), "wallaby.terry.uga.edu", dbname="tesla", user="student", password="student")
- # Querying the tesla database to fetch the latitude and longitude of the locations in Norway #
- d <- dbGetQuery(conn,"SELECT y(location) AS lon, x(location) AS lat FROM superchargers WHERE country = 'Norway'")
- # Printing the lat/long data on console #
- d
- # Involking Google Maps API for fetching the map #
- map <- get_googlemap('Norway',marker=d,zoom=4)
- # Setting configuration parameters for this map #
- ggmap(map) + labs(x = 'Longitude', y = 'Latitude') + ggtitle('Norway offices')
- # End #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement