Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Turner committed Apr 23, 2009
0 parents commit 0481dbb
Show file tree
Hide file tree
Showing 17 changed files with 11,965 additions and 0 deletions.
26 changes: 26 additions & 0 deletions TODO
@@ -0,0 +1,26 @@
TODO:

(1) Input routes for all NYC buses -- or at least the one we're tracking
(2) Geocode and reverse geocode all locations
(a) geocoding for input can use google
(b) geocoding for output can use street information from tiger:
(i) a route is an ordered set of street segments
(ii) we localize to which segment we're on, using min(st_distance(...)) and
st_dwithin for optimization. preprocess data with st_linemerge.
(iii) that gives us a gid. For the "and", we figure out
what end we're closest to, and we use st_intersects with st_startpoint
or st_endpoint to find the cross-street.

(3) represent routes as a set of route segments.

(a) this allows use of unmodified tiger data
(b) it allows calculating number of intersections, by doing:
count(*) where st_intersects() on the subset of the route between here
and there. I guess "between" means "compute the segment that we're on",
"compute the segment the target is on", and use the route's segment
ordering.

(4) using the number of intersections and bus stops to better
estimate times.

(5) warn when bus data is very out-of-date
Empty file added __init__.py
Empty file.
11 changes: 11 additions & 0 deletions initial_data.json
@@ -0,0 +1,11 @@
[
{
"model": "tracker.Route",
"pk": 1,
"fields": {
"name": "M20 Uptown",
"geometry": "0102000000320000008A027D224F8052C0779D0DF9675E44407E1D3867448052C06708C72C7B5E4440B62E35423F8052C0D44334BA835E444054539275388052C0A4DC7D8E8F5E44401C0B0A83328052C0E61C3C139A5E444077F2E9B12D8052C088653387A45E4440389F3A56298052C0170FEF39B05E44401EBE4C14218052C07C4276DEC65E44404C89247A198052C01EDC9DB5DB5E4440F0845E7F128052C0AF3E1EFAEE5E4440958098840B8052C09FA9D72D025F444069006F81048052C0BF982D59155F4440253E7782FD7F52C0AF03E78C285F4440C939B187F67F52C0FF76D9AF3B5F4440A9674128EF7F52C06CCF2C09505F4440E3E0D231E77F52C0D8F335CB655F444046072461DF7F52C06131EA5A7B5F4440CD0358E4D77F52C0516859F78F5F4440F4F75278D07F52C02F34D769A45F4440EC67B114C97F52C02A1900AAB85F4440FC19DEACC17F52C05582C5E1CC5F44409581035ABA7F52C06F8099EFE05F444075AF93FAB27F52C03BE12538F55F4440CC272B86AB7F52C078B5DC9909604440B81D1A16A37F52C0132A38BC206044402D7B12D89C7F52C0BD1C76DF31604440377007EA947F52C06A300DC34760444058A7CAF78C7F52C0D65416855D60444050172994857F52C0723106D6716044401803EB387E7F52C09D9ACB0D86604440992842EA767F52C0F8872D3D9A60444008E3A7716F7F52C006D847A7AE6044400053060E687F52C072309B00C3604440E08096AE607F52C0CD1DFD2FD760444002B859BC587F52C0AAB5300BED604440FA415DA4507F52C06934B9180361444051BAF42F497F52C0E8F7FD9B17614440492A53CC417F52C0782634492C61444077F52A323A7F52C0C765DCD44061444087A757CA327F52C0815B77F354614440556AF6402B7F52C0B28174B16961444094A0BFD0237F52C0EF552B137E6144401B9DF3531C7F52C0AF08FEB792614440A29927D7147F52C05D50DF32A7614440F911BF620D7F52C07C0BEBC6BB6144409850C1E1057F52C0CB4A9352D06144408FC01F7EFE7E52C0081F4AB4E461444076C58CF0F67E52C086E28E37F9614440CD3D247CEF7E52C0D52137C30D62444066BFEE74E77E52C0232D95B723624440"
}
}
]

11 changes: 11 additions & 0 deletions manage.py
@@ -0,0 +1,11 @@
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)

if __name__ == "__main__":
execute_manager(settings)
87 changes: 87 additions & 0 deletions settings.py
@@ -0,0 +1,87 @@
# Django settings for BusTracker project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)

MANAGERS = ADMINS

DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'novalis' # Or path to database file if using sqlite3.
DATABASE_USER = 'novalis' # Not used with sqlite3.
#DATABASE_PASSWORD = 'password' # Not used with sqlite3.
#DATABASE_HOST = 'localhost' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/New_York'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'gjz)#9_l=u$9g^2p@(l%**)qo812gx@bw^ab4w9u7+z@4jh1-j'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)

ROOT_URLCONF = 'BusTracker.urls'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"/home/novalis/match/BusTracker/tracker/templates/",
)

INSTALLED_APPS = (
# 'django.contrib.auth',
# 'django.contrib.contenttypes',
# 'django.contrib.sessions',
# 'django.contrib.sites',
'django.contrib.gis',
'django.contrib.admin',
'BusTracker.tracker'
)

POSTGIS_SQL_PATH = '/usr/share/postgresql-8.3-postgis/'
POSTGIS_TEMPLATE = 'postgis_template'
TEST_RUNNER = 'django.contrib.gis.tests.run_tests'
39 changes: 39 additions & 0 deletions setup.py
@@ -0,0 +1,39 @@
# Copyright (C) 2009 The Open Planning Project

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301
# USA

import sys, os
from setuptools import setup, find_packages

setup(
name='BusTracker',
version="0.1",
#description="",
author="The Open Planning Project",
author_email="novalis@openplans.org",
install_requires=[
"Django>=1.0.2",
"pytz",
],
packages=find_packages(),
include_package_data=True,
test_suite = 'nose.collector',
package_data={'bustracker': ['i18n/*/LC_MESSAGES/*.mo']},
entry_points={'django.apps': 'tracker = tracker'},

)
Empty file added tracker/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions tracker/admin.py
@@ -0,0 +1,4 @@
from BusTracker.tracker.models import *
from django.contrib import admin

admin.site.register(Route)

0 comments on commit 0481dbb

Please sign in to comment.