Maps

Google Maps & R Maps

You can grab satellite imagery from google maps by simply calling up the area by latitude and longitude

  1. Load packages
    library(ggmap)
    library(ggplot2)
  2. Set a range
    lat <- c(18, 23)
    lon <- c(-161, -154)
  3. Get a map
    map <- get_map(location = c(lon = mean(lon), lat = mean(lat)), zoom = 6, maptype = “satellite”, source = “google”)
    plot(map)
    hi
    4.  You can also play with the zoom and image type ie :zoom into Oahulat <- c(21.1, 21.8)
    lon <- c(-158.3, -157.567)

    map <- get_map(location = c(lon = mean(lon), lat = mean(lat)), zoom = 10, maptype = “satellite”, source = “google”)
    plot(map)
    oahu
    map2 <- get_map(location = c(lon = mean(lon), lat = mean(lat)), zoom = 10, maptype = “terrain”, source = “google”)
    plot(map2)
    oahu_terrain
    and if you want to make your map really pretty…
    map3 <- get_map(location = c(lon = mean(lon), lat = mean(lat)), zoom = 10, maptype = “watercolor”, source = “google”)
    plot(map3)

    oahu_watercolor
    https://www.r-bloggers.com/google-maps-and-ggmap/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s