from <- 'houson, texas'
to <- 'waco, texas'
route_df <- route(from, to, structure = 'route')
qmap('college station, texas', zoom = 8) +
geom_path(
aes(x = lon, y = lat), colour = 'red', size = 1.5,
data = route_df, lineend = 'round'
)
qmap('college station, texas', zoom = 6) +
geom_path(
aes(x = lon, y = lat), colour = 'red', size = 1.5,
data = route_df, lineend = 'round'
)
routeQueryCheck()
# added for R check brevity
(legs_df <- route(
'marrs mclean science, baylor university',
'220 south 3rd street, waco, tx 76701', # ninfa's
alternatives = TRUE))
qmap('424 clay avenue, waco, tx', zoom = 15, maprange = TRUE, maptype = 'hybrid',
base_layer = ggplot(aes(x = startLon, y = startLat), data = legs_df)) +
geom_leg(
aes(x = startLon, y = startLat, xend = endLon, yend = endLat, colour = route),
alpha = 3/4, size = 2, data = legs_df
) +
scale_x_continuous(breaks = pretty(c(-97.1325,-97.119),4), lim = c(-97.1325,-97.119)) +
facet_wrap(~ route) + theme_bw() +
labs(x = 'Longitude', y = 'Latitude', colour = 'Routes')
Run the code above in your browser using DataLab