Git Product home page Git Product logo

gtfs-to-geojson's People

Contributors

0xflotus avatar bjperson avatar brendannee avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gtfs-to-geojson's Issues

gtfs to geojson

Hi Mr.Nee,
I have some issues with importing gtfs data to Mapbox
firstly i should convert a zip gtfs data that I have to geojson file then I should add it to a map
i created a config.json file then when I want to run (gtfs-to-geojson --configPath /path/to/your/config.json) i will get this error :
in the following, I will send a pic of my error and my gtfs data for SanFransico
Screenshot (287)
all-transit-master.zip

skip empty name in stop

Hi I have this error:

Error: Missing required value in stops.txt for stop_name on line 11683.

Do you think I might possible to leave those missing value blank in the geojson instead of raising an error?

Best

coordinates null

I try with this dataset : http://transitfeeds.com/p/metropole-europeenne-de-lille/1202

With this config file

{
  "agencies": [
    {
      "agency_key": "myAgency",
      "path": "/Downloads/gtfs.zip",
      "exclude": [
        "stop_times",
        "calendar_dates"
      ]
    }
  ],
  "outputType" :"agency"
}

And I get null values in coordinates field:

{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"stop_id":"701","stop_name":"Buisson","stop_desc":"BUISSON 59115 LEERS","zone_id":"1","location_type":1,"wheelchair_boarding":0,"routes":{},"agency_name":"ILEVIA"},"geometry":{"type":"Point","coordinates":[null,null]}},{"type":"Feature","properties":{"stop_id":"686","stop_name":"Porte De France","stop_desc":"PORTE DE FRANCE 59115 LEERS","zone_id":"1","location_type":1,"wheelchair_boarding":0,"routes":{},"agency_name":"ILEVIA"},"geometry":{"type":"Point","coordinates":[null,null]}},{"type":"Feature","properties":{"stop_id":"709","stop_name":"Victor Hugo","stop_desc":"LEERS VICTOR 

Is this a projection problem?

Thanks

exclude stops where there isn't any shape

Hi this works very good but sometime the raw data is bad like in this example:

Screenshot 2023-11-13 at 15 52 21

As you see some route doesn't have any shape, and the algo draw a strait line between stops. Do you know of we can exclude those "routes" from the geojson output?

reading from geojson

Hello Mr.Nee,
I already converted my gtfs file to geojson and I'm so thankful
I have a problem with reading coordinates from it in js
would you please help me?
just a link will help me
thanks a lot
Alireza.

types cannot be installed

import gtfsToGeoJSON from 'gtfs-to-geojson'; generates an error
The suggested fix in VSCode is to do add the type. Our project doesn't use npm, so i use yarn add.

When I do:
yarn add @types/gtfs-to-geojson
yarn add v1.22.10
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@types%2fgtfs-to-geojson: Not found".

I am using Typescript. Is it not supported?

Shapes.txt doesn't seem to be used

I use this tool to build missing shapes.txt from some GTFS : https://github.com/pailakka/gtfs-shape-router

the file created is here: https://gist.github.com/2803media/817034ceca0d3f3a14924c5c51d9377e

I use the gtfs here: http://transitfeeds.com/p/metropole-europeenne-de-lille/1202/latest/download

I copy the missing shapes.txt inside the unzip folder

But it seems that gtfs-to-geojson doesn't use the shapes.txt, do I miss something?

The result in QGIS:

Capture d’écran 2020-11-11 à 14 27 34

When I load the shapes.txt in QGIS the file seem good as you can see below:

Capture d’écran 2020-11-11 à 14 30 47

The geojson of the shapes.txt build with the tool to create the missing file seem also good:

Capture d’écran 2020-11-11 à 14 33 31

Thanks!

no such column service_id

Hello,

not sure if it's my config , the gtfs or a bug,

(file: https://opendata.tec-wl.be/Current%20GTFS/TEC-GTFS.zip)
but when i try to run this with a GTFS unzipped folder i got:


Started GeoJSON creation for 1 agencies.
Starting GTFS import for 1 file using SQLite database at :memory:
Importing GTFS from /Users/bmaron/Downloads/TEC-GTFS/
Importing - agency.txt - 5 lines imported
Skipping - areas.txt
Skipping - attributions.txt
Importing - booking_rules.txt - No file found
Importing - calendar_dates.txt - 807 lines imported
Importing - calendar.txt - 376 lines imported
Skipping - fare_attributes.txt
Skipping - fare_leg_rules.txt
Importing - fare_media.txt - No file found
Skipping - fare_products.txt
Importing - fare_rules.txt - No file found
Skipping - fare_transfer_rules.txt
Importing - feed_info.txt - 1 lines imported
Importing - frequencies.txt - No file found
Skipping - levels.txt
Importing - location_groups.txt - No file found
Importing - location_group_stops.txt - No file found
Importing - locations.geojson - No file found
Importing - networks.txt - No file found
Skipping - pathways.txt
Importing - route_networks.txt - No file found
Importing - routes.txt - 884 lines imported
Importing - shapes.txt - 5948496 lines imported
Skipping - stop_areas.txt
Importing - stop_times.txt - 6613632 lines imported
Importing - stops.txt - 31557 lines imported
Importing - timeframes.txt - No file found
Importing - transfers.txt - No file found
Importing - translations.txt - No file found
Importing - trips.txt - 214712 lines imported
Completed GTFS import for 1 agency

Starting GeoJSON creation for tec
Error: no such column: service_id
[  SqliteError: service_id

  - wrappers.js:5 Database.prepare
    [91e41f07a2ac43c9]/[better-sqlite3]/lib/methods/wrappers.js:5:21

  - routes.js:52 getRoutes
    [91e41f07a2ac43c9]/[gtfs]/lib/gtfs/routes.js:52:6

  - gtfs-to-geojson.js:140 buildGeoJSON
    [91e41f07a2ac43c9]/[gtfs-to-geojson]/lib/gtfs-to-geojson.js:140:20

  - gtfs-to-geojson.js:256 gtfsToGeoJSON
    [91e41f07a2ac43c9]/[gtfs-to-geojson]/lib/gtfs-to-geojson.js:256:11

  - gtfs-to-geojson.js:35 async setupImport
    [91e41f07a2ac43c9]/[gtfs-to-geojson]/bin/gtfs-to-geojson.js:35:3

] {
  code: 'SQLITE_ERROR'
}

Any idea how i can solve this?

Maximum call stack size exceeded

Hi, I've been trying to create a stops-dissolved-buffer geojson out of 395000 stops.
The config file looks like this:
{
"agencies": [
{
"agency_key": "allstops1",
"path": "/home/tafflin/Documents/gtfs-to-geojson/stops1.zip",
"exclude": [
"stop_times",
"trips",
"shapes"
]
}
],
"bufferSizeMeters": 800,
"coordinatePrecision": 5,
"outputType": "agency",
"outputFormat": "stops-dissolved",
"zipOutput": false
}

The gtfs contains only a stops.txt file with necessary fields and agency.txt file with 1 test agency.
When I try to create a multi polygon geojson with stops buffer I get an error of "Maximum call stack size exceeded".
What is the maximum number of stops that can be processed and how can I increase this number if possible?
Smaller files with ~12000 stops have no issues and are generated in ~10 sec.

Screenshot 2022-09-08 192856

Error: too many sweep line segments

I get "Error: Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report." message when trying to run stops-dissolved generation with buffer size >500 meters.
My config:
{
"agencies": [
{
"agency_key": "allstops",
"path": "/home/tafflin/Documents/gtfs-to-geojson/GTFS_NI.zip",
"exclude": [
"stop_times",
"trips",
"shapes"
]
}
],
"bufferSizeMeters": 800,
"coordinatePrecision": 5,
"outputType": "agency",
"outputFormat": "stops-dissolved",
"zipOutput": false
}
GTFS_NI.zip

stop_times.txt

Hello

There is a file in the source zip: stop_times.txt. It is 380mb.

If I start the process with: lines-and-stops, it stucks at: Starting "GeoJSON creation for..." (After 10 minutes)

If I remove the stop_times.txt it generates the output within 30secs.

I would recommend a config line where you can add, what times should be excluded from the source zip file.

SQLITE error even when not using SQLITE?

I did not specify a sqlitePath in the config file, however when running gtfs-to-geojson it returns:

Starting GTFS import for 1 file
vbn: Downloading GTFS from http://www.connect-info.net/opendata/gtfs/connect-nds-toplevel/<hidden-api-key>
vbn: Download successful
vbn: Importing GTFS from /tmp/tmp-92890-Nz3KBUYM4MjY/vbn-gtfs.zip
vbn: Importing - agency.txt - 110 lines imported
vbn: Importing - attributions.txt - No file found
vbn: Importing - calendar_dates.txt - 43802 lines imported
vbn: Importing - calendar.txt - 1639 lines imported
vbn: Importing - fare_attributes.txt - No file found
vbn: Importing - fare_rules.txt - No file found
vbn: Importing - feed_info.txt - No file found
vbn: Importing - frequencies.txt - 0 lines imported
vbn: Importing - levels.txt - No file found
vbn: Importing - pathways.txt - 0 lines imported
vbn: Importing - routes.txt - 134 lines imported
Error: Error: SQLITE_CONSTRAINT: CHECK constraint failed: routes
[  Error: SQLITE_CONSTRAINT: CHECK constraint failed: routes
] {
  errno: 19,
  code: 'SQLITE_CONSTRAINT'
}

Also when using the same config file (no sqlitePath set) and providing --Skipimport it immediately returns

Starting GeoJSON creation for vbn
Error: Error: SQLITE_ERROR: no such table: routes
[  Error: SQLITE_ERROR: no such table: routes
] {
  errno: 1,
  code: 'SQLITE_ERROR'
}

Same error (SQLITE_CONSTRAINT) also happens with gtfs-to-html btw.

Ubuntu 20.04.1 LTS
Node v12.18.4
npm 6.14.6

Cannot read property '0' of undefined when loading a GTFS file

Hello,

I tried to load this GTFS: http://opendata.tec-wl.be/Current%20GTFS/TEC-GTFS.zip

With this config:

{ "mongoUrl": "mongodb://localhost:27017/gtfs", "agencies": [ { "agency_key": "L", "path": "TEC-GTFS_cleaned_trips.zip" } ], "includeStops": false, "outputType": "route", "coordinatePrecision": 5, "zipOutput": false }

With this command: gtfs-to-geojson --configPath config.json --max-old-space-size=8000

It imports everything in DB but ends with an error in the GeoJSON creation:

`Starting GTFS import for 1 file(node:73204) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

L: Importing GTFS from TEC-GTFS_cleaned_trips.zip
L: Importing - agency.txt - 5 lines imported
L: Importing - calendar_dates.txt - 341 lines imported
L: Importing - calendar.txt - 299 lines imported
L: Importing - fare_attributes.txt - No file found
L: Importing - fare_rules.txt - No file found
L: Importing - feed_info.txt - No file found
L: Importing - frequencies.txt - No file found
L: Importing - routes.txt - 810 lines imported
L: Importing - shapes.txt - 4759081 lines imported
L: Importing - stop_times.txt - 4012539 lines imported
L: Importing - stops.txt - 21573 lines imported
L: Importing - transfers.txt - No file found
L: Importing - trips.txt - 128838 lines imported
L: Post Processing data
L: Completed GTFS import
Completed GTFS import for 1 file
Starting GeoJSON creation for L
TypeError: Cannot read property '0' of undefined
at C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\simplify\main.js:233:25
at Array.map ()
at simplifyLine (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\simplify\main.js:232:35)
at simplifyGeom (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\simplify\main.js:203:35)
at C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\simplify\main.js:177:9
at Object.geomEach (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\meta\main.js:486:21)
at simplify (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\node_modules@turf\simplify\main.js:176:10)
at C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\lib\gtfs-to-geojson.js:54:35
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 0)
at async C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\lib\gtfs-to-geojson.js:51:7
at async Promise.all (index 264)
at async buildGeoJSON (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\lib\gtfs-to-geojson.js:43:5)
at async C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\lib\gtfs-to-geojson.js:102:5
at async Promise.all (index 0)
at async module.exports (C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\lib\gtfs-to-geojson.js:84:3)
at async C:\Users\denis\AppData\Roaming\npm\node_modules\gtfs-to-geojson\bin\gtfs-to-geojson.js:56:5`

I tried to isolate one route and all the corresponding trips (I removed all the other lines in these 2 text files) and it was running well... But I have no idea of which property is undefined.

Any idea on the issue? :)

Invalid Json generated?

Hello again, everything seems fine
but i look at some of my files, and they seems to be invalid JSON....

the command was launched with

{
	"agencies": [
		{
			"agency_key": "tec",
			"path": "/Users/xxx/Downloads/TEC-GTFS/"
		}
	],
	"bufferSizeMeters": 400,
	"coordinatePrecision": 5,
	"outputType": "route",
	"outputFormat": "lines-and-stops",
	"startDate": "20240616",
	"endDate": "20240617",
	"verbose": true,
	"zipOutput": false
}

here is an example (renamed as json for gh)
N_69_1.json

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.