libroutez

Trip planning library

  • Owner: wlach/libroutez
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

=== About ===

libroutez is a library written to help plan trips. Currently, its focus is
on providing directions for using public transit, but it could be easily
extended to cover other things (e.g. cycle-path planning). Specifically,
it provides an interface to solving the following problems:

  • Finding the closest point in a road/transportation network to a specific
    latitude-longitude pair.
  • Finding the shortest path between two points in a road/transportation
    network.

The design of libroutez is based on the following principles:

  • Focus on solving user and developer problems, not data structures or
    algorithms. For example, though libroutez uses the astar algorithm internally,
    we try to expose the interface to that through a simple method called
    "find_path".
  • Be extensible, but only in response to demonstrative developer need.
  • Be fast. libroutez uses an internal graph representation that, after being
    generated, can be loaded very quickly on program startup. Trips on a modest
    sized transit network can be generated in a fraction of a second on modern
    hardware (and there are plans to speed things up further).
  • Minimize memory use. Obviously the scale of public transit systems will
    incur some overhead here, but we want to be maximally useful on embedded
    systems and virtual servers where such resources may be scarce.
  • Minimize dependancies. For example, we don't assume the user wants to use a
    PostGRES database to store trip planning data (though they can if the want to).
    libroutez itself has no run-time dependancies beyond the C++ standard library.

The libroutez has utility functions for converting Google Transit Feed
(http://code.google.com/p/googletransitdatafeed) and OpenStreetMap
(http://openstreetmap.org) data into its own format. It should be very easy
to add a simple converter for your preferred data type.

=== Setup and use ===

These instructions assume you are on a UNIX-based system (e.g. Linux or
MacOS X). Windows is not currently supported.

  1. Download and install the following packages:

Helpful hint: To install a python package in a local prefix, do:

"python setup.py install --home=$HOME --prefix=" when inside the package

You may need to set PYTHONPATH to $HOME/lib/python first.

  1. Build the C++ graph module and the bindings.

The usual...

  • ./autogen.sh && ./configure && make

For an install into your home directory, try running ./configure like so:

  • ./configure --prefix=$HOME --libdir=$HOME/lib

or maybe:

  • ./configure --prefix=$HOME --libdir=$HOME/lib64 # (for many 64-bit systems)
  1. Set up your language environment.

You can either 'make install' to install the binding source to the library
directory you chose with './configure', or set your library and ruby/python
path to the libroutez source directory of your choice. e.g.:

export LD_LIBRARY_PATH=/path/to/libroutez and
export PYTHONPATH=/path/to/libroutez/python
export RUBYLIB=/path/to/libroutez/ruby

(setting RUBYLIB is only necessary if you want to use ruby, python is used
by the graph creation utility, so you almost certainly do want that in your
path)

  1. Build a graph.

To reduce application start up time, libroutez uses a custom graph format
which is created from GTFS and OpenStreetMap data. The creategraph utility
is used to create this.

The invocation is pretty simple. If you want to create a graph file called
'mygraph.routez', simply invoke creategraph.py as follows:

./creategraph.py /path/to/gtfsfeed.zip --osm="/path/to/osmfile.osm"
mygraph.routez mygraph-gtfsmapping.yml

Want some sample data to play with? You can download the combination of
William Lachance's Halifax GTFS and Geobase data:

The Halifax GTFS feed is produced by me, based on information provided
by the city of Halifax. For more information, please see:
http://github.com/wlach/halifax-transit-feed.

The OSM data is derived from the GeoBase dataset provided by the
government of Canada, and is distributed under the following terms:
http://geobase.ca/geobase/en/licence.jsp

  1. Starting playing with the library.

Now that you've built a graph, you can start planning trips. Try the
'testgraph' mini program in examples. The following corresponds to
a trip from Cogswell and Maynard to Glengarry Gardens at 9am on Monday,
September 14th 2009 in Halifax, Nova Scotia, Canada:

"testgraph mygraph.routez 44.649942 -63.583457 44.6605 -63.7467 1252933200"

You should get a bunch of directions in "routezspeak" in response. :) Note that
no attempt is currently made to prettify the output, but hopefully this will at
least give you a starting point (perhaps that would be a fun little first
project for someone who wants to contribute?). Correlating the descriptive
information contained within a Google Transit feed with libroutez's internal
data structures will necessitate using the gtfs mapping yaml file generated
by the creategraph utility.

For those who like programming in ruby and python, there are examples of both
in the same directory as 'testgraph'.

=== Contributing ===

Contributions to libroutez are gratefully accepted. The easiest thing to do
is fork my repository on github (http://github.com/wlach/libroutez), apply
your change (make sure to add your name and nature of contribution to
AUTHORS), then either email me (at wrlach@gmail.com) or the libroutez mailing
list (http://groups.google.com/group/libroutez) to let us know about what you
did. Patch files sent directly to wrlach@gmail.com are also welcome.

In order for changes to be committed, they will need to be licensed under the
same terms as the rest of libroutez (the MIT license). Please note that you
consent to this in your git commit message or mail the libroutez mailing list
saying that this (or all) your contributions are released under the MIT
license.

Main metrics

Overview
Name With Ownerwlach/libroutez
Primary LanguageC++
Program languageC (Language Count: 6)
Platform
License:MIT License
所有者活动
Created At2009-01-05 16:58:20
Pushed At2011-12-14 15:33:48
Last Commit At2011-12-14 10:32:02
Release Count0
用户参与
Stargazers Count38
Watchers Count4
Fork Count2
Commits Count129
Has Issues Enabled
Issues Count0
Issue Open Count0
Pull Requests Count0
Pull Requests Open Count1
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private