library(ggplot2)
library(ggmap) #es similar a ggplot pero ahora el lienzo es un mapa
## 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("AIzaSyBVBzq2Yz_sMFUYRQpC_4GlguOOOHiHVSw")
caliCoord <- geocode("Cali, Colombia")
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Cali,+Colombia&key=xxx
caliCoord <- c(-76.5434253,3.4299548)
location <- get_map(caliCoord, zoom=13, maptype = "watercolor") #me trae un mapa de cali
## maptype = "watercolor" is only available with source = "stamen".
## resetting to source = "stamen"...
## Source : https://maps.googleapis.com/maps/api/staticmap?center=3.429955,-76.543425&zoom=13&size=640x640&scale=2&maptype=terrain&key=xxx
## Source : http://tile.stamen.com/watercolor/13/2352/4016.jpg
## Source : http://tile.stamen.com/watercolor/13/2353/4016.jpg
## Source : http://tile.stamen.com/watercolor/13/2354/4016.jpg
## Source : http://tile.stamen.com/watercolor/13/2355/4016.jpg
## Source : http://tile.stamen.com/watercolor/13/2352/4017.jpg
## Source : http://tile.stamen.com/watercolor/13/2353/4017.jpg
## Source : http://tile.stamen.com/watercolor/13/2354/4017.jpg
## Source : http://tile.stamen.com/watercolor/13/2355/4017.jpg
## Source : http://tile.stamen.com/watercolor/13/2352/4018.jpg
## Source : http://tile.stamen.com/watercolor/13/2353/4018.jpg
## Source : http://tile.stamen.com/watercolor/13/2354/4018.jpg
## Source : http://tile.stamen.com/watercolor/13/2355/4018.jpg
## Source : http://tile.stamen.com/watercolor/13/2352/4019.jpg
## Source : http://tile.stamen.com/watercolor/13/2353/4019.jpg
## Source : http://tile.stamen.com/watercolor/13/2354/4019.jpg
## Source : http://tile.stamen.com/watercolor/13/2355/4019.jpg
plot <- ggmap(location) #construyo mi lienzo
plot

MIO_STOPS <- read.delim("~/R/MapaGoogle/MapaGoogle/MIO_STOPS.txt")
#plot <- plot + geom_point(data = MIO_STOPS, aes(x=DECIMALLONGITUDE, y=DECIMALLATITUDE),color=as.factor(MIO_STOPS$TYPE_BUS), size=5)
#plot <- plot + geom_text(data = MIO_STOPS, aes(x=DECIMALLONGITUDE, y=DECIMALLATITUDE),label=MIO_STOPS$SHORTNAME)
plot <- plot + geom_density2d()
plot
