├── .gitignore ├── .vscode └── settings.json ├── test.c ├── .settings ├── org.eclipse.cdt.ui.prefs └── org.eclipse.cdt.core.prefs ├── preprocessing.h ├── verbosity.c ├── verbosity.h ├── makefile ├── preprocessing.c ├── data_loader.h ├── README.md ├── sql_utils.h ├── sql_utils.c ├── .project ├── data_loader.c ├── create_tables.sql ├── sql_query.h ├── gtfs2pgrouting.c └── .cproject /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.d 3 | *~ 4 | gtfs2pgrouting -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cmake.configureOnOpen": false 3 | } -------------------------------------------------------------------------------- /test.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | 6 | return 1; 7 | } -------------------------------------------------------------------------------- /.settings/org.eclipse.cdt.ui.prefs: -------------------------------------------------------------------------------- 1 | #Fri Aug 19 13:34:34 IST 2011 2 | eclipse.preferences.version=1 3 | formatter_profile=_K&R 2space 4 | formatter_settings_version=1 5 | -------------------------------------------------------------------------------- /preprocessing.h: -------------------------------------------------------------------------------- 1 | #ifndef PREPROCESSING_H 2 | #define PREPROCESSING_H 3 | 4 | #include 5 | 6 | char agency_columns[7][] = { 7 | "agency_id", 8 | "agency_name", 9 | "agency_url", 10 | "agency_timezone", 11 | "agency_lang", 12 | "agency-phone", 13 | "agency_fare_url", 14 | "agency_email" 15 | } 16 | 17 | int is_in(char *string, char **list, int list_length); 18 | 19 | #endif -------------------------------------------------------------------------------- /verbosity.c: -------------------------------------------------------------------------------- 1 | /* 2 | * verbosity.c 3 | * 4 | * Created on: 19-Aug-2011 5 | * Author: jkk 6 | */ 7 | 8 | #include "verbosity.h" 9 | #include 10 | #include 11 | 12 | int print_info(const char *fmt, ...) 13 | { 14 | va_list arg; 15 | int res = 0; 16 | if (g_verbose) 17 | { 18 | va_start(arg, fmt); 19 | res = vprintf(fmt, arg); 20 | va_end(arg); 21 | } 22 | return res; 23 | } 24 | -------------------------------------------------------------------------------- /verbosity.h: -------------------------------------------------------------------------------- 1 | /* 2 | * verbosity.h 3 | * 4 | * Created on: 19-Aug-2011 5 | * Author: jkk 6 | */ 7 | 8 | #ifndef VERBOSITY_H_ 9 | #define VERBOSITY_H_ 10 | 11 | extern int g_verbose; // Global variable to be defined by the caller 12 | 13 | /** 14 | * @brief Print verbosity along the software, behave like printf 15 | * 16 | * @param fmt String to print 17 | * @param ... Vardiac arguments as for printf 18 | * @return int 19 | */ 20 | int print_info(const char *fmt, ...); 21 | 22 | #endif /* VERBOSITY_H_ */ 23 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CFLAGS=-W -Wall -pedantic -I/usr/include/postgresql 3 | 4 | # Depends on postgresql 5 | LDFLAGS=-lpq 6 | EXEC=gtfs2pgrouting 7 | 8 | 9 | all : $(EXEC) 10 | 11 | gtfs2pgrouting : gtfs2pgrouting.o sql_utils.o verbosity.o data_loader.o 12 | $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) 13 | 14 | gtfs2pgrouting.o : gtfs2pgrouting.c 15 | $(CC) -o $@ -c $^ $(CFLAGS) 16 | 17 | sql_utils.o : sql_utils.c 18 | $(CC) -o $@ -c $^ $(CFLAGS) 19 | 20 | verbosity.o : verbosity.c 21 | $(CC) -o $@ -c $^ $(CFLAGS) 22 | 23 | data_loader.o : data_loader.c 24 | $(CC) -o $@ -c $^ $(CFLAGS) 25 | 26 | clean : 27 | rm -rf *.o 28 | 29 | .PHONY: gtfs2pgrouting 30 | .PHONY: gtfs2pgrouting.o -------------------------------------------------------------------------------- /preprocessing.c: -------------------------------------------------------------------------------- 1 | #include "preprocessing.h" 2 | 3 | int is_in(char *string, char **list, int list_length) 4 | { 5 | int result = -1; 6 | 7 | int i = 0; 8 | 9 | for (i = 0; i < list_length; i++) 10 | { 11 | if(strcmp(string, list[i]) == 0) 12 | { 13 | result = i; 14 | break; 15 | } 16 | } 17 | 18 | return result; 19 | } 20 | 21 | int ignore_kth_column(int k, char *line, char delimiter) 22 | { 23 | int i, string_length = 0; 24 | 25 | string_length = strlen(line); 26 | 27 | for (i = 0; i < string_length; i++) 28 | { 29 | if (line[i] == delimiter) 30 | { 31 | 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /data_loader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * data_loader.h 3 | * 4 | * Created on: 18-Aug-2011 5 | * Author: jkk 6 | */ 7 | 8 | #ifndef DATA_LOADER_H_ 9 | #define DATA_LOADER_H_ 10 | 11 | #include "sql_utils.h" 12 | 13 | /** 14 | * @brief 15 | * 16 | */ 17 | typedef enum 18 | { 19 | G_AGENCY, 20 | G_STOPS, 21 | G_ROUTES, 22 | G_CALENDAR, 23 | G_CALENDAR_DATES, 24 | G_SHAPES, 25 | G_TRIPS, 26 | G_STOP_TIMES, 27 | G_FREQUENCIES, 28 | G_COUNT 29 | } GTFS_FILE; 30 | 31 | /** 32 | * @brief 33 | * 34 | * @param conn Postgresl connection 35 | * @param schema Name of the schema to import to 36 | * @param folder_path Path where to find the folder containing gtfs file 37 | * @return int 38 | */ 39 | int import_from_folder(PGconn *conn, char *schema, char *folder_path); 40 | 41 | #endif /* DATA_LOADER_H_ */ 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | gtfs2pgrouting 2 | ============== 3 | This is an importer tool that uses postgresql c library to load GTFS data in the form of CSV files into Postgresql database. 4 | [GTFS](http://code.google.com/transit/spec/transit_feed_specification.html) is the de-facto standard for transit data. The database schema is designed to follow the specifications as strictly as possible. The purpose of this tool is to enable pgrouting users with an easy way to import GTFS data into the database and use the newly developed 'Multi-modal public transport Routing' library. 5 | 6 | Source Code 7 | ------------ 8 | It can be open within any text editor 9 | 10 | Install 11 | ------- 12 | 1. `make` # Invoke GNU Make utility 13 | 2. `` # There is no second step. 14 | 15 | Executing 16 | --------- 17 | 1. `./gtfs2pgrouting -h` # provides a detailed list of all the options available 18 | A common scenario is to specify the database name and path to the gtfs data like this: 19 | `./gtfs2pgrouting -d mydatabase /home/user/Downloads/transit_data` 20 | -------------------------------------------------------------------------------- /sql_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sql_utils.h 3 | * 4 | * Created on: 18-Aug-2011 5 | * Author: jkk 6 | */ 7 | 8 | #ifndef SQL_UTILS_H_ 9 | #define SQL_UTILS_H_ 10 | 11 | #include 12 | 13 | /** 14 | * @brief 15 | * 16 | */ 17 | typedef struct 18 | { 19 | char *name; 20 | char *user; 21 | char *pass; 22 | char *host; 23 | char *port; 24 | } database_settings; 25 | 26 | /** 27 | * @brief Establish a connection to a PostgreSQL database 28 | * 29 | * @param db All parameters needed for connection to the DB 30 | * @return PGconn* 31 | */ 32 | PGconn *make_connection(database_settings *db); 33 | 34 | /** 35 | * @brief Run a .sql file containing a SQL query 36 | * 37 | * @param conn The PostgreSQL connection 38 | * @param file_path The path of the file to open 39 | * @return int 40 | */ 41 | int run_sql_file(PGconn *conn, char *file_path); 42 | 43 | /** 44 | * @brief Run a SQL query into a PostgreSQL database 45 | * 46 | * @param conn The PostgreSQL connection 47 | * @param sql_text The SQL query as a string 48 | * @param ... 49 | * @return int 50 | */ 51 | int run_sql(PGconn *conn, char *sql_text, ...); 52 | 53 | int add_foreign_key(PGconn *conn, char *table, char *column, char *ref_table, char *ref_column); 54 | 55 | #endif /* SQL_UTILS_H_ */ 56 | -------------------------------------------------------------------------------- /sql_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sql_utils.c 3 | * 4 | * Created on: 18-Aug-2011 5 | * Author: jkk 6 | */ 7 | 8 | #include "sql_utils.h" 9 | #include 10 | #include 11 | #include 12 | 13 | #include "verbosity.h" 14 | 15 | PGconn *make_connection(database_settings *db) 16 | { 17 | PGconn *conn = NULL; 18 | print_info("Trying to connect to database.\n"); 19 | conn = PQsetdbLogin(db->host, db->port, NULL, NULL, db->name, db->user, 20 | db->pass); 21 | if (PQstatus(conn) != CONNECTION_OK) 22 | { 23 | fprintf(stderr, "Error connecting to database.\n"); 24 | exit(-1); 25 | } 26 | print_info("Successfully connected to database.\n"); 27 | return conn; 28 | } 29 | 30 | int run_prepared_sql(PGconn *conn, char *sql) 31 | { 32 | print_info("Executing SQL: '%s'\n", sql); 33 | PGresult *res = PQexec(conn, sql); 34 | return (PQresultStatus(res) != PGRES_COMMAND_OK); 35 | } 36 | 37 | int run_sql_file(PGconn *conn, char *file_path) 38 | { 39 | char buff[1024]; 40 | char *sql = (char *)malloc(sizeof(char) * 1024); 41 | FILE *fp; 42 | int i, ret; 43 | print_info("Opening SQL file from path: '%s'", file_path); 44 | fp = fopen(file_path, "r"); 45 | if (fp == NULL) 46 | { 47 | fprintf(stderr, "Error opening file for reading: %s\n", file_path); 48 | return -1; 49 | } 50 | fgets(buff, 1024, fp); 51 | i = 1; 52 | while (!feof(fp)) 53 | { 54 | print_info("Reallocating sql buffer to %d bytes\n", i * 1024); 55 | sql = (char *)realloc(sql, sizeof(char) * i * 1024); 56 | strcat(sql, buff); 57 | fgets(buff, 1024, fp); 58 | ++i; 59 | } 60 | ret = run_prepared_sql(conn, sql); 61 | free(sql); 62 | return ret; 63 | } 64 | 65 | int run_sql(PGconn *conn, char *fmt, ...) 66 | { 67 | char sql[10240]; // XXX:Maximum size of sql < 10KB 68 | int ret; 69 | va_list arg; 70 | va_start(arg, fmt); 71 | vsprintf(sql, fmt, arg); 72 | va_end(arg); 73 | ret = run_prepared_sql(conn, sql); 74 | return ret; 75 | } 76 | 77 | 78 | int add_foreign_key(PGconn *conn, char *table, char *column, char *ref_table, char *ref_column) 79 | { 80 | PGresult *result; 81 | int res = 0; 82 | char query[1024] = {0}; 83 | 84 | sprintf(query, "ALTER TABLE %s ADD FOREIGN KEY %s REFERENCES %s(%s);", table, column, ref_table, ref_column); 85 | 86 | result = PQexec(conn, query); 87 | 88 | if (PQresultStatus(result) == PGRES_COMMAND_OK) 89 | { 90 | printf("okkkk\n"); 91 | res = 1; 92 | } else 93 | { 94 | res = 0; 95 | } 96 | } -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gtfs2pgrouting 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | ?name? 14 | 15 | 16 | 17 | org.eclipse.cdt.make.core.append_environment 18 | true 19 | 20 | 21 | org.eclipse.cdt.make.core.autoBuildTarget 22 | all 23 | 24 | 25 | org.eclipse.cdt.make.core.buildArguments 26 | 27 | 28 | 29 | org.eclipse.cdt.make.core.buildCommand 30 | make 31 | 32 | 33 | org.eclipse.cdt.make.core.buildLocation 34 | ${workspace_loc:/gtfs2pgrouting/Debug} 35 | 36 | 37 | org.eclipse.cdt.make.core.cleanBuildTarget 38 | clean 39 | 40 | 41 | org.eclipse.cdt.make.core.contents 42 | org.eclipse.cdt.make.core.activeConfigSettings 43 | 44 | 45 | org.eclipse.cdt.make.core.enableAutoBuild 46 | false 47 | 48 | 49 | org.eclipse.cdt.make.core.enableCleanBuild 50 | true 51 | 52 | 53 | org.eclipse.cdt.make.core.enableFullBuild 54 | true 55 | 56 | 57 | org.eclipse.cdt.make.core.fullBuildTarget 58 | all 59 | 60 | 61 | org.eclipse.cdt.make.core.stopOnError 62 | true 63 | 64 | 65 | org.eclipse.cdt.make.core.useDefaultBuildCmd 66 | true 67 | 68 | 69 | 70 | 71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 72 | full,incremental, 73 | 74 | 75 | 76 | 77 | 78 | org.eclipse.cdt.core.cnature 79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 81 | 82 | 83 | -------------------------------------------------------------------------------- /data_loader.c: -------------------------------------------------------------------------------- 1 | /* 2 | * data_loader.c 3 | * 4 | * Created on: 18-Aug-2011 5 | * Author: jkk 6 | */ 7 | 8 | #include "data_loader.h" 9 | #include 10 | #include 11 | 12 | #include "verbosity.h" 13 | 14 | #define BUF_SIZE 1024 15 | #define SQL_SIZE 2048 16 | 17 | const char *GTFS_FILENAME[] = {"agency.txt", 18 | "stops.txt", 19 | "routes.txt", 20 | "calendar.txt", 21 | "calendar_dates.txt", 22 | "shapes.txt", 23 | "trips.txt", 24 | "stop_times.txt", 25 | "frequencies.txt"}; 26 | 27 | const char *GTFS_TABLENAME[] = {"agency", 28 | "stops", 29 | "routes", 30 | "calendar", 31 | "calendar_dates", 32 | "shapes", 33 | "trips", 34 | "stop_times", 35 | "frequencies"}; 36 | 37 | int import_from_folder(PGconn *conn, char *schema, char *folder_path) 38 | { 39 | GTFS_FILE i; 40 | int ci; 41 | FILE *fp; 42 | char sql[SQL_SIZE] = {0}; 43 | char buf[BUF_SIZE] = {0}; 44 | PGresult *result; 45 | char *err = NULL; 46 | 47 | char is_calendar_present = 1; 48 | 49 | print_info("Entering into folder: %s\n", folder_path); 50 | if (chdir(folder_path)) 51 | { 52 | fprintf(stderr, "Unknown folder : %s\n", folder_path); 53 | return -1; 54 | } 55 | 56 | for (i = 0; i < G_COUNT; ++i) 57 | { 58 | memset(sql, 0, SQL_SIZE); 59 | memset(buf, 0, BUF_SIZE); 60 | print_info("Trying to open file: %s\n", GTFS_FILENAME[i]); 61 | fp = fopen(GTFS_FILENAME[i], "r"); 62 | if (fp == NULL) 63 | { 64 | if (i == G_CALENDAR ) 65 | { 66 | is_calendar_present = 0; 67 | print_info("Calendar not found. Calendar_dates must be present\n."); 68 | continue; 69 | } 70 | else if ((i == G_CALENDAR_DATES) && (!is_calendar_present)) { 71 | print_info("Neither Calendar not Calendar_dates found.\n"); 72 | return -1; 73 | } 74 | else if (i == G_SHAPES || i == G_FREQUENCIES) 75 | { 76 | print_info("Optional file '%s' not found. Ignored.\n", GTFS_FILENAME[i]); 77 | continue; 78 | } 79 | else 80 | { 81 | fprintf(stderr, "Required file '%s' not found\n", GTFS_FILENAME[i]); 82 | return -1; 83 | } 84 | } 85 | else 86 | { 87 | ci = 0; 88 | // while ((buf[ci++] = getc(fp)) != '\n') 89 | // ; 90 | char c = 0; 91 | while ((c = getc(fp)) != '\n') 92 | { 93 | if (c > 0) 94 | { 95 | buf[ci] = c; 96 | ci++; 97 | } 98 | } 99 | buf[ci] = '\0'; 100 | sprintf(sql, "COPY %s(%s) FROM STDIN WITH CSV HEADER;", GTFS_TABLENAME[i], buf); 101 | result = PQexec(conn, sql); 102 | 103 | printf("%s\n", sql); 104 | 105 | if (PQresultStatus(result) != PGRES_COPY_IN) 106 | { 107 | fprintf(stderr, "Error trying to copy into '%s'.\n", GTFS_TABLENAME[i]); 108 | print_info("%s\n", PQresultErrorMessage(result)); 109 | return -1; 110 | } 111 | 112 | memset(buf, 0, BUF_SIZE); 113 | 114 | fgets(buf, BUF_SIZE, fp); 115 | 116 | int errorStdIn = 0; 117 | errorStdIn = PQputCopyData(conn, buf, strlen(buf)); 118 | 119 | 120 | while (!feof(fp)) 121 | { 122 | errorStdIn = PQputCopyData(conn, buf, strlen(buf)); 123 | 124 | fgets(buf, BUF_SIZE, fp); 125 | } 126 | 127 | PQputCopyEnd(conn, err); 128 | print_info("Copied contents of '%s' into table '%s'.'%s'\n\n", GTFS_FILENAME[i], schema, GTFS_TABLENAME[i]); 129 | } 130 | fclose(fp); 131 | } 132 | return 0; 133 | } 134 | -------------------------------------------------------------------------------- /create_tables.sql: -------------------------------------------------------------------------------- 1 | CREATE DOMAIN wgs84_lat AS DOUBLE PRECISION CHECK(VALUE >= -90 AND VALUE <= 90); 2 | CREATE DOMAIN wgs84_lon AS DOUBLE PRECISION CHECK(VALUE >= -180 AND VALUE <= 180); 3 | 4 | CREATE TABLE agency 5 | ( 6 | agency_id text UNIQUE NULL, 7 | agency_name text NOT NULL, 8 | agency_url text NOT NULL, 9 | agency_timezone text NOT NULL, 10 | agency_lang text NULL, 11 | agency_phone text NULL, 12 | agency_fare_url text NULL, 13 | agency_email text NULL 14 | ); 15 | 16 | CREATE TABLE stops 17 | ( 18 | stop_id text PRIMARY KEY, 19 | stop_code text UNIQUE NULL, 20 | stop_name text NOT NULL, 21 | stop_desc text NULL, 22 | stop_lat wgs84_lat NOT NULL, 23 | stop_lon wgs84_lon NOT NULL, 24 | zone_id text NULL, 25 | stop_url text NULL, 26 | location_type int NULL, 27 | parent_station text NULL, 28 | stop_timezone text NULL, 29 | wheelchair_boarding int NULL, 30 | level_id text NULL, 31 | platform_code text NULL 32 | ); 33 | 34 | CREATE TABLE routes 35 | ( 36 | route_id text PRIMARY KEY, 37 | agency_id text NULL REFERENCES agency(agency_id) ON DELETE CASCADE, 38 | route_short_name text NOT NULL, 39 | route_long_name text NOT NULL, 40 | route_desc text NULL, 41 | route_type integer NOT NULL CHECK(route_type >= 0 and route_type <= 12), 42 | route_url text NULL, 43 | route_color text NULL, 44 | route_text_color text NULL, 45 | route_sort_order int NULL CHECK(route_sort_order > 0), 46 | continuous_pickup int NULL CHECK(continuous_pickup >= 0 and continuous_pickup <= 3), 47 | continuous_dropoff int NULL CHECK(continuous_dropoff >= 0 and continuous_dropoff <= 3) 48 | ); 49 | 50 | CREATE TABLE calendar 51 | ( 52 | service_id text PRIMARY KEY, 53 | monday boolean NOT NULL, 54 | tuesday boolean NOT NULL, 55 | wednesday boolean NOT NULL, 56 | thursday boolean NOT NULL, 57 | friday boolean NOT NULL, 58 | saturday boolean NOT NULL, 59 | sunday boolean NOT NULL, 60 | start_date numeric(8) NOT NULL, 61 | end_date numeric(8) NOT NULL 62 | ); 63 | 64 | CREATE TABLE shapes 65 | ( 66 | shape_id text, 67 | shape_pt_lat wgs84_lat NOT NULL, 68 | shape_pt_lon wgs84_lon NOT NULL, 69 | shape_pt_sequence integer NOT NULL, 70 | shape_dist_traveled double precision NULL, 71 | PRIMARY KEY (shape_id, shape_pt_sequence) 72 | ); 73 | 74 | CREATE TABLE trips 75 | ( 76 | route_id text NOT NULL REFERENCES routes ON DELETE CASCADE, 77 | service_id text NOT NULL REFERENCES calendar, 78 | trip_id text NOT NULL PRIMARY KEY, 79 | trip_headsign text NULL, 80 | trip_short_name text NULL, 81 | direction_id boolean NULL, 82 | block_id text NULL, 83 | shape_id text NULL, 84 | wheelchair_accessible int NULL, 85 | bikes_allowed int NULL 86 | ); 87 | 88 | CREATE TABLE stop_times 89 | ( 90 | trip_id text NOT NULL REFERENCES trips ON DELETE CASCADE, 91 | arrival_time interval NOT NULL, 92 | departure_time interval NOT NULL, 93 | stop_id text NOT NULL REFERENCES stops ON DELETE CASCADE, 94 | stop_sequence integer NOT NULL, 95 | stop_headsign text NULL, 96 | pickup_type integer NULL CHECK(pickup_type >= 0 and pickup_type <=3), 97 | drop_off_type integer NULL CHECK(drop_off_type >= 0 and drop_off_type <=3), 98 | shape_dist_traveled double precision NULL, 99 | timepoint boolean NULL, 100 | PRIMARY KEY (trip_id, stop_sequence) 101 | ); 102 | 103 | CREATE TABLE frequencies 104 | ( 105 | trip_id text NOT NULL REFERENCES trips ON DELETE CASCADE, 106 | start_time interval NOT NULL, 107 | end_time interval NOT NULL, 108 | headway_secs integer NOT NULL 109 | ); 110 | -------------------------------------------------------------------------------- /sql_query.h: -------------------------------------------------------------------------------- 1 | #ifndef SQL_QUERY_H 2 | #define SQL_QUERY_H 3 | 4 | char tablesCreationQuery[] = "CREATE DOMAIN wgs84_lat AS DOUBLE PRECISION CHECK(VALUE >= -90 AND VALUE <= 90);\n" 5 | "CREATE DOMAIN wgs84_lon AS DOUBLE PRECISION CHECK(VALUE >= -180 AND VALUE <= 180);\n\n" 6 | 7 | "CREATE TABLE agency\n" 8 | "(\n" 9 | " agency_id text UNIQUE NULL,\n" 10 | " agency_name text NOT NULL,\n" 11 | " agency_url text NOT NULL,\n" 12 | " agency_timezone text NOT NULL,\n" 13 | " agency_lang text NULL,\n" 14 | " agency_phone text NULL,\n" 15 | " agency_fare_url text NULL,\n" 16 | " agency_email text NULL\n" 17 | ");\n\n" 18 | 19 | "CREATE TABLE stops\n" 20 | "(\n" 21 | " stop_id text PRIMARY KEY,\n" 22 | " stop_code text NULL,\n" 23 | " stop_name text NOT NULL,\n" 24 | " stop_desc text NULL,\n" 25 | " stop_lat wgs84_lat NOT NULL,\n" 26 | " stop_lon wgs84_lon NOT NULL,\n" 27 | " zone_id text NULL,\n" 28 | " stop_url text NULL,\n" 29 | " location_type int2 NULL CHECK(location_type >= 0 and location_type <= 4),\n" 30 | " parent_station text NULL,\n" 31 | " stop_timezone text NULL,\n" 32 | " wheelchair_boarding int2 NULL CHECK(wheelchair_boarding >= 0 and wheelchair_boarding <= 2 ),\n" 33 | " level_id text NULL,\n" 34 | " platform_code text NULL\n" 35 | ");\n\n" 36 | 37 | "CREATE TABLE routes\n" 38 | "(\n" 39 | " route_id text PRIMARY KEY,\n" 40 | " agency_id text NULL,\n" 41 | " route_short_name text NOT NULL,\n" 42 | " route_long_name text NOT NULL,\n" 43 | " route_desc text NULL,\n" 44 | " route_type int2 NOT NULL CHECK(route_type >= 0 and route_type <= 12),\n" 45 | " route_url text NULL,\n" 46 | " route_color text NULL,\n" 47 | " route_text_color text NULL,\n" 48 | " route_sort_order int NULL CHECK(route_sort_order > 0),\n" 49 | " continuous_pickup int2 NULL CHECK(continuous_pickup >= 0 and continuous_pickup <= 3),\n" 50 | " continuous_dropoff int2 NULL CHECK(continuous_dropoff >= 0 and continuous_dropoff <= 3)\n" 51 | ");\n\n" 52 | 53 | "CREATE TABLE calendar\n" 54 | "(\n" 55 | " service_id text PRIMARY KEY,\n" 56 | " monday boolean NOT NULL,\n" 57 | " tuesday boolean NOT NULL,\n" 58 | " wednesday boolean NOT NULL,\n" 59 | " thursday boolean NOT NULL,\n" 60 | " friday boolean NOT NULL,\n" 61 | " saturday boolean NOT NULL,\n" 62 | " sunday boolean NOT NULL,\n" 63 | " start_date date NOT NULL,\n" 64 | " end_date date NOT NULL\n" 65 | ");\n\n" 66 | 67 | "CREATE TABLE calendar_dates\n" 68 | "(\n" 69 | "service_id text NOT NULL,\n" 70 | "date date NOT NULL,\n" 71 | "exception_type int2 NOT NULL CHECK(exception_type >= 1 and exception_type <= 2)\n" 72 | ");\n\n" 73 | 74 | "CREATE TABLE shapes\n" 75 | "(\n" 76 | " shape_id text,\n" 77 | " shape_pt_lat wgs84_lat NOT NULL,\n" 78 | " shape_pt_lon wgs84_lon NOT NULL,\n" 79 | " shape_pt_sequence integer NOT NULL,\n" 80 | " shape_dist_traveled double precision NULL,\n" 81 | " PRIMARY KEY (shape_id, shape_pt_sequence)\n" 82 | ");\n\n" 83 | 84 | "CREATE TABLE trips\n" 85 | "(\n" 86 | " route_id text NOT NULL,\n" 87 | " service_id text NOT NULL ,\n" 88 | " trip_id text NOT NULL PRIMARY KEY,\n" 89 | " trip_headsign text NULL,\n" 90 | " trip_short_name text NULL,\n" 91 | " direction_id boolean NULL,\n" 92 | " block_id text NULL,\n" 93 | " shape_id text NULL,\n" 94 | " wheelchair_accessible int NULL,\n" 95 | " bikes_allowed int2 NULL CHECK(bikes_allowed >= 0 and bikes_allowed <=2)\n" 96 | ");\n\n" 97 | 98 | "CREATE TABLE stop_times\n" 99 | "(\n" 100 | " trip_id text NOT NULL,\n" 101 | " arrival_time interval NOT NULL,\n" 102 | " departure_time interval NOT NULL,\n" 103 | " stop_id text NOT NULL,\n" 104 | " stop_sequence integer NOT NULL,\n" 105 | " stop_headsign text NULL,\n" 106 | " pickup_type int2 NULL ,\n" 107 | " drop_off_type int2 NULL,\n" 108 | " shape_dist_traveled double precision NULL,\n" 109 | " timepoint boolean NULL,\n" 110 | " local_zone_id text NULL\n" 111 | ");\n\n" 112 | 113 | "CREATE TABLE frequencies\n" 114 | "(\n" 115 | " trip_id text NOT NULL,\n" 116 | " start_time time NOT NULL,\n" 117 | " end_time time NOT NULL,\n" 118 | " headway_secs integer NOT NULL\n" 119 | ");\n"; 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /gtfs2pgrouting.c: -------------------------------------------------------------------------------- 1 | /* 2 | * gtfs2pgrouting.c 3 | * 4 | * Created on: 18-Aug-2011 5 | * Author: jkk 6 | */ 7 | // #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "data_loader.h" 13 | #include "sql_utils.h" 14 | #include "sql_query.h" 15 | #include "verbosity.h" 16 | int g_verbose; 17 | 18 | const char *argp_program_version = "gtfs2pgrouting 0.9.1"; 19 | const char *argp_program_bug_address = ""; 20 | 21 | /* Program documentation. */ 22 | static char doc[] = 23 | "gtfs2pgrouting - Import GTFS from csv into postgres database"; 24 | 25 | const char usage[] = 26 | "Usage : gtfs2pgrouting [options] "; 27 | 28 | const char options_help[] = 29 | "\tOptions : \n" 30 | "\t\t-d name\t\tName of the database\n" 31 | "\t\t-u user\t\tUsername of the database\n" 32 | "\t\t-p password\tPassword of the database\n" 33 | "\t\t-H host\t\tHost of the database\n" 34 | "\t\t-P port\t\tPort of the database\n" 35 | "\t\t-v \t\tProduce verbose output\n" 36 | "\t\t-t format\tType of GTFS input. Options are: 'folder', 'zip' (Default is 'folder')\n" 37 | "\t\t-s schema\tSchema for grouping all gtfs tables (Default is 'gtfs')\n" 38 | "\t\t-D \t\tSpecify if the gtfs tables are already created, used to append to existing gtfs data\n" 39 | "\t\t-h \t\tShow this help"; 40 | /* A description of the arguments we accept. */ 41 | // static char args_doc[] = "INPUT_SOURCE"; 42 | 43 | const char options[] = "d:u:p:H:P:vt:s:Dh"; 44 | 45 | void print_help() 46 | { 47 | printf("%s\n", doc); 48 | printf("%s\n", usage); 49 | printf("%s\n", options_help); 50 | } 51 | /* The options we understand. */ 52 | // static struct argp_option options[] = 53 | // { { 0, 0, 0, 0, "Database Settings:" }, 54 | // { "dbname", 'd', "DBNAME", 0, "Database name(mandatory)" }, 55 | // { "dbuser", 'u', "DBUSER", 0, "Database username" }, 56 | // { "dbpass", 'p', "DBPASS", 0, "Database password" }, 57 | // { "dbhost", 'h', "HOSTNAME", 0, "Database hostname" }, 58 | // { "dbport", 'P', "DBPORT", 0, "Database port" }, 59 | // { 0, 0, 0, 0, "General Options:" }, 60 | // { "verbose", 'v', 0, 0, "Produce verbose output" }, 61 | // { "format", 62 | // 't', 63 | // "FORMAT", 64 | // 0, 65 | // "Type of GTFS input. Options are: 'folder', 'zip'. Default:'folder'" }, 66 | // { "schema", 67 | // 's', 68 | // "SCHEMA", 69 | // 0, 70 | // "Schema for grouping all gtfs tables. Default is 'gtfs'" }, 71 | // { "data-only", 72 | // 'D', 73 | // 0, 74 | // 0, 75 | // "Specify if the gtfs tables are already created.\n" 76 | // "Used to append to existing gtfs data." }, 77 | // { 0 } }; 78 | 79 | /* Used by main to communicate with parse_opt. */ 80 | struct arguments 81 | { 82 | char *schema; 83 | char *input_source; 84 | int verbose; 85 | char *format; 86 | int data_only; 87 | char help; 88 | database_settings db; 89 | }; 90 | 91 | // /* Parse a single option. */ 92 | // static error_t parse_opt(int key, char *arg, struct argp_state *state) { 93 | // /* Get the input argument from argp_parse, which we 94 | // know is a pointer to our arguments structure. */ 95 | // struct arguments *arguments = state->input; 96 | 97 | // switch (key) { 98 | // case 'd': 99 | // arguments->db.name = arg; 100 | // break; 101 | // case 'u': 102 | // arguments->db.user = arg; 103 | // break; 104 | // case 'p': 105 | // arguments->db.pass = arg; 106 | // break; 107 | // case 'h': 108 | // arguments->db.pass = arg; 109 | // break; 110 | // case 'P': 111 | // arguments->db.port = arg; 112 | // break; 113 | // case 'v': 114 | // arguments->verbose = 1; 115 | // break; 116 | // case 't': 117 | // arguments->format = arg; 118 | // break; 119 | // case 's': 120 | // arguments->schema = arg; 121 | // break; 122 | // case 'D': 123 | // arguments->data_only = 1; 124 | // break; 125 | // case ARGP_KEY_ARG: 126 | // if (state->arg_num >= 2) 127 | // /* Too many arguments. */ 128 | // argp_usage(state); 129 | // arguments->input_source = arg; 130 | // state->next = state->argc; 131 | // break; 132 | 133 | // case ARGP_KEY_END: 134 | // if (state->arg_num < 1) 135 | // /* Not enough arguments. */ 136 | // argp_usage(state); 137 | // break; 138 | 139 | // default: 140 | // return ARGP_ERR_UNKNOWN; 141 | // } 142 | // return 0; 143 | // } 144 | 145 | static void parse_args(int argc, char *argv[], const char *options, struct arguments *args) 146 | { 147 | int opt = 0; 148 | while ((opt = getopt(argc, argv, options)) != -1) 149 | { 150 | switch (opt) 151 | { 152 | case 'd': 153 | args->db.name = optarg; 154 | break; 155 | 156 | case 'u': 157 | args->db.user = optarg; 158 | break; 159 | 160 | case 'p': 161 | args->db.pass = optarg; 162 | break; 163 | 164 | case 'H': 165 | args->db.host = optarg; 166 | break; 167 | 168 | case 'P': 169 | args->db.port = optarg; 170 | break; 171 | 172 | case 'v': 173 | args->verbose = 1; 174 | break; 175 | 176 | case 't': 177 | args->format = optarg; 178 | break; 179 | 180 | case 's': 181 | args->schema = optarg; 182 | break; 183 | 184 | case 'D': 185 | args->data_only = 1; 186 | break; 187 | 188 | case 'h': 189 | args->help = 1; 190 | 191 | default: 192 | break; 193 | } 194 | } 195 | args->input_source = argv[argc - 1]; 196 | } 197 | 198 | /* Our argp parser. */ 199 | // static struct argp argp = { options, parse_opt, args_doc, doc }; 200 | 201 | int main(int argc, char **argv) 202 | { 203 | struct arguments arguments; 204 | PGconn *conn; 205 | 206 | // printf("%s\n", argv[argc-1]); 207 | 208 | /* Default values. */ 209 | memset(&(arguments.db), 0, sizeof(database_settings)); 210 | arguments.db.user = NULL; 211 | arguments.db.pass = NULL; 212 | arguments.db.host = NULL; 213 | arguments.db.port = NULL; 214 | arguments.verbose = 0; 215 | arguments.format = "folder"; 216 | arguments.schema = "gtfs"; 217 | arguments.data_only = 0; 218 | arguments.help = 0; 219 | 220 | /* Parse our arguments; every option seen by parse_opt will 221 | be reflected in arguments. */ 222 | // argp_parse(&argp, argc, argv, 0, 0, &arguments); 223 | parse_args(argc, argv, options, &arguments); 224 | g_verbose = arguments.verbose; 225 | 226 | if (arguments.help) 227 | { 228 | print_help(); 229 | return 1; 230 | } 231 | 232 | conn = make_connection(&(arguments.db)); 233 | 234 | if (!arguments.data_only) 235 | { 236 | if (run_sql(conn, "create schema %s", arguments.schema) || run_sql(conn, "set search_path to %s", arguments.schema) || run_sql(conn, tablesCreationQuery)) 237 | { 238 | fprintf( 239 | stderr, 240 | "Error setting up gtfs schema\nIf the tables are already present, run with -D flag to skip schema creation\n"); 241 | exit(1); 242 | } 243 | printf("Successfully set up the gtfs schema.\n"); 244 | } 245 | 246 | if (!strcmp(arguments.format, "folder")) 247 | { 248 | if (run_sql(conn, "set search_path to %s", arguments.schema) || import_from_folder(conn, arguments.schema, arguments.input_source)) 249 | { 250 | fprintf(stderr, "Error importing gtfs from folder.\n"); 251 | exit(1); 252 | } 253 | printf("Successfully imported gtfs data from folder.\n"); 254 | } 255 | else if (!strcmp(arguments.format, "zip")) 256 | { 257 | fprintf(stderr, "This feature is not supported yet.\n"); 258 | } 259 | 260 | exit(0); 261 | } 262 | -------------------------------------------------------------------------------- /.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 35 | 36 | 37 | 38 | 41 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 82 | 83 | 88 | 89 | 90 | 91 | 94 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | #Fri Aug 19 13:34:34 IST 2011 2 | eclipse.preferences.version=1 3 | org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16 4 | org.eclipse.cdt.core.formatter.alignment_for_assignment=16 5 | org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80 6 | org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16 7 | org.eclipse.cdt.core.formatter.alignment_for_compact_if=16 8 | org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34 9 | org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18 10 | org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0 11 | org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16 12 | org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48 13 | org.eclipse.cdt.core.formatter.alignment_for_expression_list=0 14 | org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=82 15 | org.eclipse.cdt.core.formatter.alignment_for_member_access=0 16 | org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16 17 | org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16 18 | org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 19 | org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line 20 | org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line 21 | org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line 22 | org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line 23 | org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line 24 | org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line 25 | org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line 26 | org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1 27 | org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false 28 | org.eclipse.cdt.core.formatter.compact_else_if=true 29 | org.eclipse.cdt.core.formatter.continuation_indentation=2 30 | org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2 31 | org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false 32 | org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false 33 | org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0 34 | org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true 35 | org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false 36 | org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true 37 | org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false 38 | org.eclipse.cdt.core.formatter.indent_empty_lines=false 39 | org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true 40 | org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true 41 | org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true 42 | org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false 43 | org.eclipse.cdt.core.formatter.indentation.size=2 44 | org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert 45 | org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert 46 | org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert 47 | org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert 48 | org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert 49 | org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert 50 | org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert 51 | org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert 52 | org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert 53 | org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert 54 | org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert 55 | org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert 56 | org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert 57 | org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert 58 | org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert 59 | org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert 60 | org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert 61 | org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert 62 | org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert 63 | org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert 64 | org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert 65 | org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert 66 | org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert 67 | org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert 68 | org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert 69 | org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert 70 | org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert 71 | org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert 72 | org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert 73 | org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert 74 | org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert 75 | org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert 76 | org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert 77 | org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert 78 | org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert 79 | org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert 80 | org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert 81 | org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert 82 | org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert 83 | org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert 84 | org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert 85 | org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert 86 | org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert 87 | org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert 88 | org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert 89 | org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert 90 | org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert 91 | org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert 92 | org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert 93 | org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert 94 | org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert 95 | org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert 96 | org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert 97 | org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert 98 | org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert 99 | org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert 100 | org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert 101 | org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert 102 | org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert 103 | org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert 104 | org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert 105 | org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert 106 | org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert 107 | org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert 108 | org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert 109 | org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert 110 | org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert 111 | org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert 112 | org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert 113 | org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert 114 | org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert 115 | org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert 116 | org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert 117 | org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert 118 | org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert 119 | org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert 120 | org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert 121 | org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert 122 | org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert 123 | org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert 124 | org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert 125 | org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert 126 | org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert 127 | org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert 128 | org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert 129 | org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert 130 | org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert 131 | org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert 132 | org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert 133 | org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert 134 | org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert 135 | org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert 136 | org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert 137 | org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert 138 | org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert 139 | org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert 140 | org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert 141 | org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert 142 | org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert 143 | org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert 144 | org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert 145 | org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert 146 | org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert 147 | org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert 148 | org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert 149 | org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert 150 | org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert 151 | org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert 152 | org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert 153 | org.eclipse.cdt.core.formatter.join_wrapped_lines=true 154 | org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false 155 | org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=true 156 | org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false 157 | org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false 158 | org.eclipse.cdt.core.formatter.lineSplit=80 159 | org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1 160 | org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true 161 | org.eclipse.cdt.core.formatter.tabulation.char=space 162 | org.eclipse.cdt.core.formatter.tabulation.size=2 163 | org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false 164 | --------------------------------------------------------------------------------