Skip to content

Instantly share code, notes, and snippets.

View generateShapes.sql
insert into shapes (shape_id, shape_pt_lat, shape_pt_lon, shape_pt_sequence)
select distinct stop_times.trip_id, stop_lat, stop_lon, stop_sequence
from
stop_times
inner join stops on stop_times.stop_id = stops.stop_id
inner join trips on stop_times.trip_id = trips.trip_id
where trips.shape_id not in (select shape_id from shapes)
order by stop_times.trip_id, stop_sequence;
View NordicPublicTransportNetwork.Rd
library(ggmap)
library(ggplot2)
library(ggthemes)
library(dplyr)
require(data.table)
print("read GTFS data started")
# use fread for increased speed (~1GB shapes.txt)
shapes <- fread("[shapes_path]/shapes.txt", sep =",", encoding ="UTF-8")
print("read GTFS data finished")
View outTrVAPI.json
This file has been truncated, but you can view the full file.
{"RESPONSE":{"RESULT":[{"TrainAnnouncement":[{"AdvertisedTimeAtLocation":"2019-01-21T09:09:00","AdvertisedTrainIdent":"7103","ToLocation":[{"LocationName":"Uåö","Priority":1,"Order":0}],"TrackAtLocation":"1"},{"AdvertisedTimeAtLocation":"2019-01-21T09:19:00","AdvertisedTrainIdent":"7103","ToLocation":[{"
LocationName":"Uåö","Priority":1,"Order":0}],"TrackAtLocation":"2"},{"AdvertisedTimeAtLocation":"2019-01-21T09:34:00","AdvertisedTrainIdent":"7103","ToLocation":[{"LocationName":"Uåö","Priority":1,"Order":0}],"TrackAtLocation":"1"},{"AdvertisedTimeAtLocation":"2019-01-21T10:29:00","AdvertisedTrainIdent":"
92","ToLocation":[{"LocationName":"Le","Priority":1,"Order":0}],"TrackAtLocation":"2"},{"AdvertisedTimeAtLocation":"2019-01-21T10:34:00","AdvertisedTrainIdent":"96","ToLocation":[{"LocationName":"No.nk","Priority":1,"Order":0}],"TrackAtLocation":"3"},{"AdvertisedTimeAtLocation":"2019-01-21T10:53:00","
@rudmark
rudmark / 0_reuse_code.js
Last active Sep 21, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rudmark
rudmark / gist:3948395
Created Oct 24, 2012
trafikverket-trainexport-error
View gist:3948395
<ORIONML>
<ERROR>no such column: tru</ERROR>
</ORIONML>
@rudmark
rudmark / gist:3938476
Created Oct 23, 2012
trafikverket-error
View gist:3938476
<ORIONML>
<ERROR>near ",": syntax error</ERROR>
</ORIONML>
@rudmark
rudmark / gist:3928297
Created Oct 21, 2012
trafikverket-trainexport-api-traffic
View gist:3928297
<ORIONML>
<RESPONSE plugin="WOW">
<Trafiklagen>
<Trafiklage>
<Utgangsdatum>2012-10-21T00:00:00+02:00</Utgangsdatum>
<TagGrupp>dcc8d495-21f3-4d78-be9d-c9a5aaaf8c27</TagGrupp>
<TagGruppOrdning>14</TagGruppOrdning>
<TrafikInfoAgareNamn>Stockholmståg/SL</TrafikInfoAgareNamn>
<TrafikInfoAgareUrl>http://www.sl.se</TrafikInfoAgareUrl>
<TrafikInfoAgareMobilUrl>http://www.sl.se</TrafikInfoAgareMobilUrl>
@rudmark
rudmark / gist:3928266
Created Oct 21, 2012
trafikverket-trainexport-api-stations
View gist:3928266
<ORIONML>
<RESPONSE plugin="KartDB">
<Stations>
<Station>
<CountyNo>24</CountyNo>
<EPSG>3006</EPSG>
<EW>732865</EW>
<Id>1f227415-178d-45ea-a0ca-c8a1847a266c</Id>
<IkonNiva>trafikplats_dp</IkonNiva>
<Namn>Vännäs</Namn>
@rudmark
rudmark / gist:3928232
Created Oct 21, 2012
trafikverket-trainexport-api-messages
View gist:3928232
<ORIONML>
<RESPONSE plugin="KartDB">
<Messages>
<Message>
<Id>1027279</Id>
<CountyNo>14</CountyNo>
<EPSG>3006</EPSG>
<EW>285159</EW>
<Header>banarbete</Header>
<IconId>1005</IconId>
@rudmark
rudmark / gist:3917152
Created Oct 19, 2012
trafikverket-traininfo-api-train
View gist:3917152
<ORIONML version="1.0">
<RESPONSE plugin="WOW">
<LpvTrafiklagen>
<Trafiklage>
<_ModifiedTime>2012-10-19T11:26:09+02:00</_ModifiedTime>
<Utgangsdatum>2012-10-19T00:00:00+02:00</Utgangsdatum>
<TagGrupp>025c722e-9e15-4454-b260-3ae1d2343f1c</TagGrupp>
<TrafikInfoAgareNamn>SJ</TrafikInfoAgareNamn>
<TrafikInfoAgareUrl>http://www.sj.se/sj/jsp/polopoly.jsp?d=288</TrafikInfoAgareUrl>
<TrafikInfoAgareMobilUrl>http://www.sj.se/sj/jsp/polopoly.jsp?d=288</TrafikInfoAgareMobilUrl>