/gtfs2shp

Convert a GTFS feed into an ESRI shapefile.

Primary LanguageGoGNU General Public License v2.0GPL-2.0

Go Report Card Build Status

gtfs2shp

Convert a GTFS feed into an ESRI shapefile.

Credits

Creation of this tool was supported by geOps, Freiburg.

Installation

$ go get github.com/patrickbr/gtfs2shp

Requires golang version >= 1.7.

Usage

Convert the Chicago GTFS file to a shapefile:

$ gtfs2shp -i google_transit.zip -f output.shp

The primary entity will be the GTFS shapes. Routes/trips using this shapes will be stored in shapefile attributes as aggregated IDs and route short-names.

The result will look like this:

Chicago Public Transit Network

Station geometries

If you also need the station geometries, just add the -s flag.

$ gtfs2shp -i google_transit.zip -f output.shp -s

Station points along with all their GTFS attributes will be written into <filename>.station.shp, in the above case to output.station.shp.

Explicit trips

If you need more trip/route information, use the -t mode.

$ gtfs2shp -i google_transit.zip -f output.shp -t

An explicit geometry together with all trip/route attributes will be written for each trip. Note that this will create redundant geometries.

Coordinate reprojection

By default, coordinates will be outputted untouched as WGS84 (Lat/Lng) coordinates. If you need to reproject them, you can do so by using the -p parameter.

For example,

$ gtfs2shp -i google_transit.zip -f output.shp -p 3857

will yield a shapefile with coordinates into Google Web Mercator (EPSG:3857) projection. Projections can either be specified as EPSG codes or as a proj4 string:

$ gtfs2shp -i google_transit.zip -f output.shp -p "+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs"

MOT Filtering

By default, all vehicles defined in the GTFS feed will be included. You can specify which transportation types (MOTs) will be included in the output by setting the -m parameter to a comma separated list ot MOTs (as defined in the GTFS ref). For example, to only output the rail network of Chicago, use:

$ gtfs2shp -i google_transit.zip -f output.shp -m 1,2

Flags

See

$ gtfs2shp --help

for available command line arguments.

License

See LICENSE.