apikey<-"AIzaSyBPxhDW9_bUJ1juxXEGvY_QcNIZNJPUy7A"

library(ggplot2)
library(ggmap)
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
register_google(apikey)

qmap(c(-76.5,3.43),zoom=13,maptype="hybrid")
## Source : https://maps.googleapis.com/maps/api/staticmap?center=3.43,-76.5&zoom=13&size=640x640&scale=2&maptype=hybrid&language=en-EN&key=xxx

otro tipo de mapa con estaciones de mio:

library(readr)
MIO_STOPS <- read.delim("C:/Users/braya/Desktop/MEA/semestre 3/Analitica de datos/Maps/MIO_STOPS.txt")

#adicionar columnas de agrupamiento
k<-7
niter<-100
grupos<-kmeans(MIO_STOPS[,c(7,8)],k,iter.max=niter, nstart=1)

MIO_STOPS$grupos<-grupos$cluster

city<-get_map(c(-76.5,3.43),zoom=12)
## Source : https://maps.googleapis.com/maps/api/staticmap?center=3.43,-76.5&zoom=12&size=640x640&scale=2&maptype=terrain&language=en-EN&key=xxx
mapa <- ggmap(city)
mapa <- mapa + geom_point(data =MIO_STOPS, aes(x=DECIMALLONGITUDE,y=DECIMALLATITUDE), color=MIO_STOPS$grupos, size=MIO_STOPS$PASSANGERS_NUM*0.02 )
mapa

agregar un poligono:

indicesc1<-chull(MIO_STOPS$grupos==1)
poligono <-MIO_STOPS[indicesc1,]
mapa<- mapa + geom_polygon(data=poligono,aes(x=DECIMALLONGITUDE,y=DECIMALLATITUDE), color="black",alpha=0.2)
mapa