Skip to content

Instantly share code, notes, and snippets.

@iUmarov
Created November 21, 2017 10:16
Show Gist options
  • Select an option

  • Save iUmarov/c02ae14c5ecc4a3d1f1df9e6a285235d to your computer and use it in GitHub Desktop.

Select an option

Save iUmarov/c02ae14c5ecc4a3d1f1df9e6a285235d to your computer and use it in GitHub Desktop.

Revisions

  1. iUmarov created this gist Nov 21, 2017.
    17 changes: 17 additions & 0 deletions Starbucks_near_ohio.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #install.packages("googleway")
    library(googleway)

    key <- 'AIzaSyCOEzgiO1P6trrSmu9vy9ZVuQDkog6Lwiw'

    df_places <- google_places(search_string = "Starbucks",
    location = c(40.417287, -82.907123),
    key = key)

    df_places$results$formatted_address

    cen <- c(mean(df_places$results$geometry$location$lng), mean(df_places$results$geometry$location$lat))

    gc <- data.frame(lon=df_places$results$geometry$location$lng, lat = df_places$results$geometry$location$lat)

    map <- get_googlemap(center = cen, scale = 1, maptype = "roadmap", zoom = 10, marker = gc)
    ggmap(map, extent = "device")