[SOLVED] Working with gtfs2mongo library


#1

Hi all,

I’m Francesco and first of all it’s a pleasure to be part on this forum:).

I’m working with Meteor and gtfs files, I have to save my gtfs files on mongo db (default version) and I using a gtfs2mongo library, but I can’t load a local file system path when i pass this on the convert method .
below an code example:

  gtfsMongo.convert(res,db,  function(err){
			
			if(err) {
				throw err;
			}		
   }); 

error message :./home/mamba/Programmi/meteor/project/agenzia_trasporti_converter/data/stops.txt not found. Aborting read operation.

I tried with res = ‘data’ , res = 'home/mamba/Programmi/meteor/project/agenzia_trasporti_converter/data’
Inside data there are all gtfs files and I didn’t change files name.

How can get a resource , as a file, from my fylesystem?

I hope that someone would can help me.

Thanks a lot.

Francesco.


#2

Just an observation - your error message and res value both indicate that home is relative to your current directory. Have you tried /home?


#3

Hi,

thx for your response.

If I change the path from :

res = 'home/mamba/Programmi/meteor/project/agenzia_trasporti_converter/data; 

to :

res = '/home/mamba/Programmi/meteor/project/agenzia_trasporti_converter/data';

Error message is the same but with an extra backslash:

.//home/mamba/Programmi/meteor/project/agenzia_trasporti_converter/data/agency.txt not found. Aborting read operation.

I think that there is a path visibility error or something like that or I don’t understand how meteor path works.

I’m looking for something that can help me, but I have not found anything.

Any other advice?

Thx a lot for your patience.

Francesco.


#4

So, I’m assuming you’re using this while developing a Meteor app, and your app’s code is in /home/mamba/Programmi/meteor/project/agenzia_trasporti_converter/?

If that’s the case, then it should be sufficient to set `res = ‘data’, since it’s reporting errors relative to your current directory.


#5

Nothing , this is the output :

./data/agency.txt not found. Aborting read operation.
./data/calendar.txt not found. Aborting read operation.
./data/calendar_dates.txt not found. Aborting read operation.
./data/stops.txt not found. Aborting read operation.
./data/routes.txt not found. Aborting read operation.
./data/trips.txt not found. Aborting read operation.
./data/stop_times.txt not found. Aborting read operation.
./data/fare_attributes.txt not found. Aborting read operation.
./data/fare_rules.txt not found. Aborting read operation.
./data/shapes.txt not found. Aborting read operation.
./data/frequencies.txt not found. Aborting read operation.
./data/transfers.txt not found. Aborting read operation.
./data/feed_info.txt not found. Aborting read operation.

data folder content is:

agency.txt calendar_dates.txt fare_attributes.txt fare_rules.txt feed_info.txt routes.txt shapes.txt stops.txt stop_times.txt trips.txt.

Thx again.

Francesco.


#6

How have you integrated gtfs2mongo with Meteor?


#7

Here’s another thought. In the Example Usage for gtfs2mongo, the example shown appears to be from a Meteor project. Can you contact the developer for help?


#8

I followed this link to getting started with this library, I’ll try to contact the developer, thank you again for your help.
Keep me posted if you would find something new :).

Thx again, cheers.


#9

I found this:

Remove ./ when calculating path\n\nUnfortunately, this breaks usage of absolute paths, which I hit when downloading GTFS data, unzipping it to a temp directory created by node-temp, then attempting to import. If the user wants a relative path with ./ prepended, they should explicitly ask for it. Thanks. to Remove ./ when calculating pathUnfortunately, this breaks usage of absolute paths, which I hit when downloading GTFS data, unzipping it to a temp directory created by node-temp, then attempting to import. If the user wants a relative path with ./ prepended, they should explicitly ask for it. Thanks.

I’ll try to do it, I’ll keep you updated.


#10

For those who need it, gtfs2mongo on meteor can see only /tmp/… dir ( in linux system).

Thx for your support rob:).

Problem Resolved.


#11

Cool. Glad you got there in the end. :smile:


#12

Thank you Rob :)).

Francesco