distance_map {traveltimeR}R Documentation

Distance Map

Description

Given origin coordinates, find shapes of zones reachable within corresponding travel distance. Find unions/intersections between different searches

Usage

distance_map(
  departure_searches = NULL,
  arrival_searches = NULL,
  unions = NULL,
  intersections = NULL,
  format = NULL
)

Arguments

departure_searches

One or more objects created by make_search

arrival_searches

One or more objects created by make_search

unions

One or more objects created by make_union_intersect

intersections

One or more objects created by make_union_intersect

format

distance-map response format. See https://docs.traveltime.com/api/reference/distance-map#Response-Body for details.

Details

See https://docs.traveltime.com/api/reference/distance-map/ for details

Value

API response parsed as a list and as a raw json

Examples

## Not run: 

dateTime <- strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ")

departure_search <-
  make_search(id = "driving from Trafalgar Square",
              departure_time = dateTime,
              travel_distance = 900,
              coords = list(lat = 51.507609, lng = -0.128315),
              transportation = list(type = "driving"))

arrival_search <-
  make_search(id = "driving to Trafalgar Square",
              arrival_time = dateTime,
              travel_distance = 900,
              coords = list(lat = 51.507609, lng = -0.128315),
              transportation = list(type = "driving"),
              range = list(enabled = TRUE, width = 3600))

union <- make_union_intersect(id = "union of driving to and from Trafalgar Square",
                               search_ids = list('driving from Trafalgar Square',
                                                 'driving to Trafalgar Square'))
intersection <- make_union_intersect(id = "intersection of driving to and from Trafalgar Square",
                               search_ids = list('driving from Trafalgar Square',
                                                 'driving to Trafalgar Square'))
result <-
  distance_map(
    departure_searches = departure_search,
    arrival_searches = arrival_search,
    unions = union,
    intersections = intersection
  )

## End(Not run)

[Package traveltimeR version 1.2.1 Index]