sourcecode

Showing posts with label auto. Show all posts
Showing posts with label auto. Show all posts

Monday, July 8, 2013

OpenTripPlanner

Getting OpenTripPlanner to work and more:

1. Download, configure and test run on http
https://github.com/openplans/OpenTripPlanner/wiki/TwoMinutes

note: once the browser opens http://localhost:8080/opentripplanner-webapp
the background maybe empty. On the far right of the  page, click the "+" sign. Then under "Base Layer" and choose "Open Street Map" (or others, instead of the default "Mapbox Steets")



2. Test the Stand-alone mode, which is used as an API
https://github.com/openplans/OpenTripPlanner/wiki


3. Json or Xml (default) result can be generated:
 https://github.com/openplans/OpenTripPlanner/wiki/JsonOrXml

EXAMPLE:
curl --header "Accept: application/json" "http://maps5.trimet.org/osm?mode=BICYCLE&toPlace=45.504966%2C-122.654349&fromPlace=45.5115225%2C-122.647633"
vs.
curl --header "Accept: application/xml" "http://maps5.trimet.org/osm?mode=BICYCLE&toPlace=45.504966%2C-122.654349&fromPlace=45.5115225%2C-122.647633"

4. Build graphs:
https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder

protoc protobuf Protocol Buffers

This blog entry lists the process to use google's Protoco Buffers, on x64 Linux Mint 14.

1. Download protobuf-2.5.0.tar.bz2 from
https://code.google.com/p/protobuf/downloads/list


2.  Extract the file anywhere.

3. Under the extracted folder, run
$./configure
$make
$make check
$sudo make install

4.  View the README file in the folder, and test some common:
  $pkg-config --cflags protobuf         # print compiler flags
  $pkg-config --libs protobuf           # print linker flags
  $pkg-config --cflags --libs protobuf  # print both


5.  Download a proto file. e.g. from
https://developers.google.com/transit/gtfs-realtime/gtfs-realtime-proto

6.  Go to the proto file folder and generate the C++ header and source file:
$protoc gtfs-realtime.proto --cpp_out=./
Ref: https://developers.google.com/protocol-buffers/docs/proto


7. If there are some errors, check the environment variables 
$export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib   $export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
Ref:  http://blog.csdn.net/programmer_h/article/details/8890800


8.  Write a sample main file:
#include <iostream>
#include <string>
#include <fstream>
#include "gtfs-realtime.pb.h"
using namespace std;

int main()
{
   fstream file("alert2.dat");
   string outline;
   getline(file, outline);
   cout <&lt outline << endl;
}

9. Download a sample encoded binary data file: e.g.
 http://www.bart.gov/dev/gtrtfs/alerts.aspx


10. Compile:
$clang++ main.cpp gtfs-realtime.pb.cc `pkg-config --cflags --libs protobuf`


Saturday, June 30, 2012

Bash login logout script file

http://www.linuxfromscratch.org/blfs/view/stable/postlfs/profile.html
to prepare the environment when a login/shell starts up, modify the file:
~/.bash_profile
to clean up and/or run script upon logout, edit the file:
~/.bash_logout

/****************END*****************/