Learn R Programming

baidumap (version 0.2.2)

getRoute: Get route from query Take in a original location and destination, return the direction

Description

Get route from query Take in a original location and destination, return the direction

Usage

getRoute(...)

Arguments

origin

the original location

destination

the destination

mode

'driving'(default), 'walking', or 'transit'

region

the city of of original location and destination. If original and destination is not in the same city, set `origin_region` and `destination_region` seperately.

origin_region

the city of original location. If not set, use `region` instead.

destination_region

the city of destination. If not set, use `region` instead.

tactics

10(no expressway), 11(default, shortest time), 12(shortest path).

coord_type

'bd09ll'(default), 'gcj02'(which Google map and Soso map are using), 'wgs84' for GPS devices.

Value

a data frame contains longtitude and latitude of the route.

Examples

Run this code
# NOT RUN {
bjMap = getBaiduMap('<U+5317><U+4EAC>', color='bw')
df = getRoute('<U+9996><U+90FD><U+56FD><U+9645><U+673A><U+573A>', '<U+5317><U+4EAC><U+5357><U+82D1><U+673A><U+573A>', region = '<U+5317><U+4EAC>')
ggmap(bjMap) + geom_path(data = df, aes(lon, lat), alpha = 0.5, col = 'red')
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab