Skip to content

Instantly share code, notes, and snippets.

@iUmarov
Created November 21, 2017 10:14
Show Gist options
  • Save iUmarov/a1edd61db3a015b37188735a8b615d33 to your computer and use it in GitHub Desktop.
Save iUmarov/a1edd61db3a015b37188735a8b615d33 to your computer and use it in GitHub Desktop.
7 Markers in Tashkent
#install.packages("ggplot2")
library(ggplot2)
names <- c("Toshkent Xalqa Avtomobil Yo'li, Tashkent, Uzbekistan",
"Istiklol Palace",
"Dinamo",
"Tashkent Higher All-Troops Command College",
"SARC Uzbekiston Temir Yullari",
"Amir Temur Square",
"MY HOME")
addr <- c("Toshkent Xalqa Avtomobil Yo'li, Tashkent, Uzbekistan",
"Istiklol Palace, Tashkent, Uzbekistan",
"Dinamo, Tashkent, Uzbekistan",
"Tashkent Higher All-Troops Command College, Tashkent, Uzbekistan",
"SARC Uzbekiston Temir Yullari, Tashkent, Uzbekistan",
"Amir Temur Square, Tashkent, Uzbekistan",
"69.207378, 41.375954")
#coords <- geocode(enc2utf8(addr))
#lon <- c(69.207378)
#lat <- c(41.375954)
#myhome <- as.data.frame(cbind(lon,lat))
#coords
gc <- rbind(coords, myhome)
df <- data.frame(name = names, lon = gc$lon, lat = gc$lat)
cen <- c(mean(df$lon), mean(df$lat))
map <- get_googlemap(center = cen, maptype = "roadmap", zoom = 11, marker = gc)
gmap <- ggmap(map)
gmap + geom_text(data = df, aes(x = lon, y = lat),
size = 3, label = df$name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment