Comments (9)
@orlandoandradeb I downloaded those data, and it works fine. The error in your case states "column name 'stop_id' is not found." This strongly suggests that something has happened to your data. Reproducible code to demonstrate that it works is here:
library (gtfsrouter)
u <- "https://transitfeeds.com/p/mexico-city-federal-district-government/70/latest/download"
f <- "mex-gtfs.zip"
download.file (u, destfile = f)
x <- extract_gtfs (filename = f)
#> Warning: This feed contains no transfers.txt
summary (x)
#> A gtfs object with the following tables and respective numbers of entries in each:
#> agency calendar desktop.ini frequencies routes shapes
#> 8 99 3 1741 145 29148
#> stop_times stops trips
#> 70714 6021 1741
#> Note: This feed contains no transfers.txt table
Created on 2019-09-23 by the reprex package (v0.3.0)
The extract_gtfs()
function works perfectly. I suggest you try downloading your data afresh and try again.
from gtfsrouter.
Good question! The basic idea is this:
route <- gtfs_route (gtfs, from = from, to = to, start_time = start_time, include_ids = TRUE)
library (dplyr)
library (geodist)
d <- left_join (route, my_grfs_data$stops, by = "stop_id") %>%
geodist (sequential = TRUE)
That of course will only give you the direct straight-line distances between each stop, which will not necessarily be the true distance. There are ways to work out actual distances too, dependent on whether it's street transport (bus, tram) or train lines. Either way, the combination of osmdata
and sosgr
will be able to do that. It will of course be quite a bit more complicated ... let me know if straight line distances suffice.
from gtfsrouter.
Hello, @mpadge thank you for your answer I will try this code. In principle it will be enough this level of accuracy.
I want to generate what is called "Deuter Index" that measures the efficiency of a transport network to make straight trips from a big set of origin and destination in the service area. This for compare 2 different transit network in the same area and quantify which network make more trips straight.
Thank you again.
from gtfsrouter.
Hello @mpadge
There is a much more basic problem that I have not solved in 2 days. When I want to read my GTFS file
gtfs <- extract_gtfs (filename = "gtfs.zip")
I just got a message of error:
Error in
[.data.table
(stops, , stop_id) :
j (the 2nd argument inside [...]) is a single symbol but column name 'stop_id' is not found. Perhaps you intended DT[, ..stop_id]. This difference to data.frame is deliberate and explained in FAQ 1.1.
In addition: There were 22 warnings (use warnings() to see them)
It says that I should see question 1.1 but I don't see any FAQ section in the web https://atfutures.github.io/gtfs-router/
I am sure that the structure of my gtfs files are fine due to I have used them and validate in other software.
from gtfsrouter.
Can you please provide some code to reproduce that problem? In particular, a URL for the data you use. Thanks
from gtfsrouter.
I just start the code so is extremely short:
library(gtfsrouter) rm(list = ls(all=TRUE))
getwd() setwd("~/UPC/PhD/Papers/Paper 3/Data")
packageVersion("gtfsrouter") gtfs <- extract_gtfs (filename = "gtfs.zip")
The GTFS data that I have is in the following link:
https://transitfeeds.com/p/mexico-city-federal-district-government/70/latest/download
from gtfsrouter.
Hey @orlandoandradeb, could you use download.file()
to download the GTFS dataset? Will make it easier to reproduce.
from gtfsrouter.
@mpadge @Robinlovelace Thank you both for your answer. I will be checking my computer these days (versions of software) because I see the syntax and does not have a sense why still I get an error.
I changed of computer and I update my R version and the error is still there but just in a different way.
I have tried with 3 different sets of GTFS from my interna memory and refreshing the set from transitfeeds.com from Madrid, Barcelona and Mexico City and none of them work.
from gtfsrouter.
You need to paste some reproducible code via reprex
, because i get no error. You code will need to be a self-contained chunk that downloads and extracts the data. Make sure that you use full path names in all cases, and that you pass the full file name as your variable f
to both download.file
and extract.gtfs
. Currently your error is not reproducible. It looks very much to me like you are simply pointing things in the wrong direction, and passing a non-existent file to extract_gtfs()
from gtfsrouter.
Related Issues (20)
- gtfs_route randomly crashes the session HOT 2
- gtfs_traveltimes output HOT 6
- no results when calculating gtfs_traveltimes() HOT 2
- SVG version of the logo HOT 8
- Allow start times to be vector of times for each station HOT 1
- Bug in traveltimes algorithm HOT 1
- Update documentation to include example for gtfs_route with (lon, lat) please HOT 3
- Move atfutures -> UrbanAnalyst
- Proportion of trips on different route_types HOT 4
- rcpp_csa | Not compatible with requested type HOT 3
- Reduce ratios of user / elapsed times in examples HOT 2
- Fix pkg man entry
- CRAN UBSAN issues
- CRAN re-submit HOT 2
- pkgcheck results - main HOT 8
- Alternative approach to build a transfer table HOT 8
- Using gtfs_traveltimes for many-to-many calculations HOT 6
- gtfs_traveltimes bug when setting max_traveltime HOT 5
- route_table does not generate fastest travel HOT 3
- New CRAN version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gtfsrouter.