library(ggmap)
## Warning: package 'ggmap' was built under R version 3.3.3
## Loading required package: ggplot2
library(maps)
## Warning: package 'maps' was built under R version 3.3.3
library(RColorBrewer)
library(raster)
## Warning: package 'raster' was built under R version 3.3.3
## Loading required package: sp
## Warning: package 'sp' was built under R version 3.3.3
library(ggplot2)
library(mapdata)
## Warning: package 'mapdata' was built under R version 3.3.3
wash<- c(lon = 120.7401, lat = 47.7511)
map1 <- get_map(wash, zoom = 5, scale = 1)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=47.7511,120.7401&zoom=5&size=640x640&scale=1&maptype=terrain&language=en-EN&sensor=false
ggmap(map1)
# A negative latitude means South of the Equator, and a negative longitude means West of the Prime Meridian.
map2 <- get_map(location = c (lon = -120.740135, lat = 47.7511), zoom = 6, scale = 1)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=47.7511,-120.740135&zoom=6&size=640x640&scale=1&maptype=terrain&language=en-EN&sensor=false
ggmap(map2)
map('county', 'washington')
# WorldHires dataset = This world database comes from a cleaned-up version of the CIA World Data Bank II data and contains approximately 2 million points representing the world coastlines and national boundaries. This makes it suitable for extracting countries, continents, etc. while still retaining lots of detail.
map("worldHires",xlim=c(-126,-115),ylim=c(44,49),fill=TRUE,col="grey")
map.axes()
map.scale()
states <- map_data("state")
counties <- map_data("county")
washington <- subset(states, region == "washington")
wa_county <- subset(counties, region =="washington")
ggplot(data = washington) +
geom_polygon(aes(x = long, y = lat))
wa_map <- ggplot(data = washington, mapping = aes(x = long, y = lat, group = group)) +
coord_fixed(1.3) +
geom_polygon(color = 0, fill = "red")+
geom_polygon(data = wa_county, fill = NA, color = "white")
wa_map