Giter VIP home page Giter VIP logo

Comments (9)

mpadge avatar mpadge commented on July 30, 2024 2

@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.

mpadge avatar mpadge commented on July 30, 2024

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.

orlandombaa avatar orlandombaa commented on July 30, 2024

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.

orlandombaa avatar orlandombaa commented on July 30, 2024

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.

mpadge avatar mpadge commented on July 30, 2024

Can you please provide some code to reproduce that problem? In particular, a URL for the data you use. Thanks

from gtfsrouter.

orlandombaa avatar orlandombaa commented on July 30, 2024

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.

Robinlovelace avatar Robinlovelace commented on July 30, 2024

Hey @orlandoandradeb, could you use download.file() to download the GTFS dataset? Will make it easier to reproduce.

from gtfsrouter.

orlandombaa avatar orlandombaa commented on July 30, 2024

@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.

Screen Shot 2019-09-23 at 8 31 47 PM

Captura de pantalla (151)

from gtfsrouter.

mpadge avatar mpadge commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.