tests/testthat/test-spatial.R

context('Converting GTFS routes and shapes into simple feature (sf) dataframes')
library(sf)

# convert_gtfs_routes_to_sf()
test_that('Can convert a gtfsr routes dataframe to a simple features dataframe', {
	expect_is(routes_df_as_sf(gtfs_obj), 'sf')
})

test_that('Can convert a gtfsr stops dataframe to a simple features dataframe', {
  expect_is(stops_df_as_sf(gtfs_obj$stops_df), 'sf')
})

test_that('Can filter on route id', {
  routes <- c(1681,1683)
  tworoutes <- gtsf::routes_df_as_sf(gtfs_obj,route_ids=routes)
  expect_equal(dim(tworoutes)[1],2)
})
r-gtfs/gtsf documentation built on Aug. 25, 2018, 2:12 p.m.