Skip to content

Instantly share code, notes, and snippets.

@buma
buma / gist:749feb180b9751b2952d
Last active August 29, 2015 13:57
Script for adding ref number to bus_stops for OSM before inserting to DB
# -*- coding: utf-8 -*-
from __future__ import print_function
import xml.etree.cElementTree as ET
from lxml import etree
from collections import defaultdict
__author__ = 'MaBu'
file_path = './deli rute.osm'
file_path_output = './deli rute_out.osm'
@buma
buma / my-graph-config.xml
Last active August 29, 2015 13:59
XML config file for OpenTripPlanner
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<bean id="gtfsBuilder" class="org.opentripplanner.graph_builder.impl.GtfsGraphBuilderImpl">
<property name="gtfsBundles">
<bean id="gtfsBundles" class="org.opentripplanner.graph_builder.model.GtfsBundles">
<property name="bundles">
@buma
buma / gist:8e1a5c4c4954e2c36e59
Last active August 29, 2015 14:05
Diff of linking
diff --git a/otp-core/src/main/java/org/opentripplanner/routing/impl/CandidateEdge.java b/otp-core/src/main/java/org/opentripplanner/routing/impl/CandidateEdge.java
index 560208f..129fa38 100644
--- a/otp-core/src/main/java/org/opentripplanner/routing/impl/CandidateEdge.java
+++ b/otp-core/src/main/java/org/opentripplanner/routing/impl/CandidateEdge.java
@@ -137,7 +137,7 @@ public class CandidateEdge {
}
// Calculate the score last so it can use all other data.
- score = calcScore();
+ score = calcScore(mode);
@buma
buma / OTP plan example.json
Created May 18, 2015 13:03
Example of JSON plan output
Request JSON
{
"requestParameters": {
"date": "05-18-2015",
"mode": "TRANSIT,WALK",
"arriveBy": "false",
"wheelchair": "false",
"showIntermediateStops": "false",
"fromPlace": "46.556499533500876,15.612258911132812",
@buma
buma / python-xlib_utf_name_support.diff
Created May 24, 2015 09:51
Changes needed in python xlib to support UTF8 WM_NAME
Index: Xlib/Xatom.py
===================================================================
--- Xlib/Xatom.py (revision 171)
+++ Xlib/Xatom.py (working copy)
@@ -85,3 +85,6 @@
WM_CLASS = 67
WM_TRANSIENT_FOR = 68
LAST_PREDEFINED = 68
+#Added
+UTF8_STRING = 291
@buma
buma / builder.patch
Created June 23, 2015 13:09
Quickfix for annotations builder
diff --git a/src/main/java/org/opentripplanner/graph_builder/AnnotationsToHTML.java b/src/main/java/org/opentripplanner/graph_builder/AnnotationsToHTML.java
index fbb55ed..db16731 100644
--- a/src/main/java/org/opentripplanner/graph_builder/AnnotationsToHTML.java
+++ b/src/main/java/org/opentripplanner/graph_builder/AnnotationsToHTML.java
@@ -211,7 +211,9 @@ public class AnnotationsToHTML implements GraphBuilderModule {
private void addAnnotation(GraphBuilderAnnotation annotation) {
String className = annotation.getClass().getSimpleName();
- annotations.put(className, annotation.getHTMLMessage());
+ if (annotations.get(className).size() < 50) {
@buma
buma / main.diff
Created October 19, 2015 14:55
Changes needed in OTP to run TN
diff --git a/src/main/java/org/opentripplanner/standalone/OTPMain.java b/src/main/java/org/opentripplanner/standalone/OTPMain.java
index 81c928a..5dfd8a5 100644
--- a/src/main/java/org/opentripplanner/standalone/OTPMain.java
+++ b/src/main/java/org/opentripplanner/standalone/OTPMain.java
@@ -115,10 +115,10 @@ public class OTPMain {
/* Start graph builder if requested */
if (params.build != null) {
- GraphBuilder graphBuilder = GraphBuilder.forDirectory(params, params.build); // TODO multiple directories
+ /* GraphBuilder graphBuilder = GraphBuilder.forDirectory(params, params.build); // TODO multiple directories
@buma
buma / build-config.json
Created October 19, 2015 14:58
Speed support in build config
{
speeds:{
units:"km/h",
values:{
"highway=motorway": 130,
"highway=motorway_link": 100,
"highway=trunk": 110,
"highway=trunk_link": 100,
"highway=primary": 90,
"highway=primary_link": 90,
@buma
buma / mapbox.html
Created November 9, 2015 17:05
Mapbox GL visualizer
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.2/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.2/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@buma
buma / opentripplanner.adoc
Created November 16, 2015 17:09
Generated ascidoc for OTP

REST resources of project

`GET `

Request

No body

Response

Content-Type: application/json, application/xml;qs=0.5, text/xml;qs=0.5