Skip to content

Commit

Permalink
Merge branch 'rhunter-remove-route-geom'
Browse files Browse the repository at this point in the history
  • Loading branch information
rghunter committed Sep 28, 2015
2 parents 9b89d89 + 51bd428 commit 6285b6a
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions gtfsdb/model/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class Route(Base):
route_color = Column(String(6))
route_text_color = Column(String(6))
route_sort_order = Column(Integer)
the_geom = deferred(Column(Geometry('MULTILINESTRING', spatial_index=False)))

trips = relationship('Trip', primaryjoin='Trip.route_id==Route.route_id',
foreign_keys='(Trip.route_id)', uselist=True, backref='route',
Expand Down Expand Up @@ -123,34 +122,6 @@ def start_date(self):
def end_date(self):
return self._get_start_end_dates[1]

@classmethod
def load_geoms(cls, db):
'''load derived geometries, currently only written for PostgreSQL'''
from gtfsdb.model.shape import ShapeGeom
from gtfsdb.model.trip import Trip

if db.is_geospatial and db.is_postgresql:
start_time = time.time()
session = db.session
routes = session.query(Route).all()
for route in routes:
s = func.st_collect(ShapeGeom.the_geom)
s = func.st_multi(s)
s = func.st_astext(s).label('the_geom')
q = session.query(s)
q = q.filter(ShapeGeom.trips.any((Trip.route == route)))
route.the_geom = q.first().the_geom
session.merge(route)
session.commit()
processing_time = time.time() - start_time
log.debug('{0}.load_geoms ({1:.0f} seconds)'.format(
cls.__name__, processing_time))

@classmethod
def add_geometry_column(cls):
#TODO Remove
pass

@classmethod
def active_routes(cls, session, date=None):
''' returns list of routes that are seen as 'active' based on dates and filters
Expand Down

0 comments on commit 6285b6a

Please sign in to comment.