inegi_route: Returns the route between two points in Mexico

View source: R/v3_sakbe.R

inegi_routeR Documentation

Returns the route between two points in Mexico

Description

Uses SAKBE API to return a route between two destiny id's considering the given parameters.

Usage

inegi_route(from, to, token, pref, vehicle, calc_cost = FALSE,
  rawJSON = FALSE)

Arguments

from

Destiny id from where the route begins

to

Destiny id of end of route

token

Sakbe API token supplied by INEGI

pref

Preference for road: 1 = with tolls (cuota), 2 = without tolls (libre), 2 = suggested route

vehicle

Vehicle choice: 0 = motorcycle, 1 = auto, 2 = two axis bus, 3 = three axis bus, 4 = four axis bus, 5 = two axis truck, 6 = three axis truck, 7 = four axis truck, 8 = five axis truck, 9 = six axis truck, 10 = seven axis truck, 11 = eight axis truck, 12 = nine axis truck.

calc_cost

if TRUE will use the price of gasoline to calculate total cost of trip. Very experimental, defaults to FALSE.

rawJSON

if TRUE returns only the JSON data, not parsed

Value

list

Note

To calculate the cost, it is wiser to use the more conservative estimate. Thus, this function assumes a premium type of gasoline (the most expensive) at the lower end bound of fuel-efficiency (11 kms per liter)

Author(s)

Eduardo Flores

References

See the official API here: http://www.inegi.org.mx/desarrolladores/sakbe/apisakbe.aspx

Examples

# Macroplaza in Monterrey to Mexico City airport.
## Not run: 
token <- "webservice_token"
route <- inegi_route(from = 6940, to = 57, token, pref = 2, vehicle = 1)

## End(Not run)

Eflores89/inegiR documentation built on Jan. 31, 2024, 4:19 a.m.