9

I would like to use QGIS to create my map. One data feed is the gtfs regarding to bus routes. I can view it on Google Earth (although laggy), but when I tried to import the .kml into QGIS, it just ran out of RAM (for 30 min) and crashed my map. If I import 10 in the 18xx layers, the route is duplicated 10 times (Google Earth could show all the routes, although laggy).

My procedure

I am trying a new method, so...

What I did was download the .txt on TfNSW website (Google tfnsw data and login), then use a .py script called Transitfeed by bdferris to convert the .txt into .kml. Finally import the .kml as vector layers, but I did viewed in Google Earth prior that so I though it will be okay.

I am intended to convert the shape.txt into route shapes.

Problem

I was thinking of the possibilities and solutions, for example:

  1. Faulty .kml
  2. Faulty .txt in the gtfs
  3. Faulty conversion from .txt to .kml

I was thinking if either first two possibilities are valid, then what is the suitable validation (of my .kml) solution? Otherwise I would like a cost-less (i.e. monetary) solution for viewing gtfs .txt file into QGIS.

  • 1
    when I view the gtfs specification, it's all text files, and doesn't mention anything about kml. Is there something else you're doing with the gtfs file first? developers.google.com/transit/gtfs/reference – neuhausr Jan 8 '15 at 14:29
  • Sorry did nit mentioned that, I converted the txt to kml file. It is okay to view in Google Earth, but not QGIS. – SHY.John Jan 8 '15 at 22:16
  • Can you add how you converted the txt to kml, and add a link to a sample txt or kml file? – AndreJ Jan 13 '15 at 9:11
  • Please wait, I will do this in a minute... – SHY.John Jan 13 '15 at 9:24
  • Have you considered just using the .txt converting to .csv and then using the "Watch file" option in QGIS - if you're trying to stream the routes "live"? – Andrew Tice Jan 13 '15 at 9:55
5

From http://code.google.com/p/googletransitdatafeed/wiki/PublicFeeds, I took the data from TriMet Portland and had no problem adding the geometry data (stops.txt and shapes.txt) to QGIS with the MMQGIS plugin.

Once installed, use MMQGIS -> Import/Export -> Geometry Import from CSV file

Geometry Type Point for the stops and Polylinefor the shapes.

If you experience the same laggy effect as with Google Earth, you might save the result to a spatialite database. Or store the data in a postgis database, as explained here:

http://opendesignarch.blogspot.de/2014/03/loading-gtfs-data-into-postgresql.html

https://github.com/pgRouting/pgrouting/wiki/MMPTR-Tutorial

  • I did what you told and got a message: Invalid shape ID column: shape_id... In addition, it is CSV not CSF. – SHY.John Jan 13 '15 at 12:47
  • Never mind, it's just means I have to change my field name to something like ID, lon, lat. – SHY.John Jan 13 '15 at 13:02
  • For the TriMet data, it worked fine. Maybe your file has some strange data. – AndreJ Jan 13 '15 at 13:04
  • No, for unknown reason, MMQGIS accepts ID, lat and lon as names. – SHY.John Jan 13 '15 at 13:39
3

I have used the Points2One plugin and I found it pretty straight forward. https://youtu.be/cxAkTg_01vg

1 - Import GTFS file named 'shapes.txt' using 'Add limited Text Layer'

2 - Click on the Points2One plugin and create Lines by "shape_id"

  • Will try later, as this is 0200 at Sydney. – SHY.John Jun 4 '15 at 15:51
1

I found this really nice tutorial by google search:

http://www.stevencanplan.com/2016/02/converting-a-transit-agencys-gtfs-to-shapefile-and-geojson-with-qgis/

I got my data here: http://apps2.saskatoon.ca/app/data/google_transit.zip

In order to make the points into a path, it looks like the Points to Path plugin does not ship with qgis 3, but it looks like qgis 3 comes bundled with a points to path tool thanks to another post I found here: https://gis.stackexchange.com/a/241494/145631.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.