Skip to content

TransiTime Config

Claudiu Bogdan Minea edited this page Dec 24, 2021 · 2 revisions

You need to create one Hibernate XML with database parameters and one TransitClock XML file with database parameters and GPS data source for each agency you are adding. My advice is to replace AGENCY with a simple keyword identifying your agency so that you know what you're editing if you have a multi-tenant setup.

/usr/local/transitclock/config/hibernate_AGENCY.cfg.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
 <session-factory>
   <property name="hibernate.dialect">
      org.hibernate.dialect.DB-TYPEDialect (org.hibernate.dialect.MySQLDialect)
   </property>
   <property name="hibernate.connection.driver_class">
      com.DB-TYPE.jdbc.Driver (com.mysql.jdbc.Driver)
   </property>
   <property name="format_sql">true</property>
   <property name="use_sql_comments">true</property>
   <property name="hibernate.c3p0.min_size">2</property>
   <property name="hibernate.c3p0.max_size">20</property>
   <property name="hibernate.c3p0.timeout">300</property>
   <property name="hibernate.c3p0.max_statements">50</property>
   <property name="hibernate.jdbc.batch_size">25</property>
   <property name="hibernate.connection.url">jdbc:DB-TYPE://DB-HOST/DB-NAME (jdbc:mysql://localhost/...)</property>
   <property name="hibernate.connection.username">DB-USER</property>
   <property name="hibernate.connection.password">DB-PASSWORD</property>
        <mapping resource="named_queries.hbm.xml" />
 </session-factory>
</hibernate-configuration>

/usr/local/transitclock/config/AGENCY.xml Please pay attention to adjust this according to your data source. The file example below contains example both for getting GPS data both from a GTFS-Realtime VehiclePositions protocol buffer feed or from a Traccar (open source AVL platform) instance for which you have the link and credentials.

<?xml version="1.0" encoding="UTF-8"?>
<transitclock>
    <modules>
        <!-- only keep one of the lines below according to how you're getting GPS data - either GTFS-RealTime VehiclePositions or Traccar -->
        <optionalModulesList>org.transitclock.core.schedBasedPreds.SchedBasedPredsModule;org.transitclock.avl.GtfsRealtimeModule</optionalModulesList>
        <optionalModulesList>org.transitclock.core.schedBasedPreds.SchedBasedPredsModule;org.transitclock.custom.traccar.TraccarAVLModule</optionalModulesList>
    </modules>
    <autoBlockAssigner><autoAssignerEnabled>true</autoAssignerEnabled></autoBlockAssigner>
    <core>
        <agencyId>GTFS AGENCY ID</agencyId>
    </core>
    <avl>
        <!-- providing details for connection and authentication in order to pull location details from Traccar, omit if you're configuring GTFS realtime below -->
        <traccar>
                <baseurl>http://localhost:8082 - or whatever your traccar instance address is</baseurl>
                <email>access_email_for_traccar</email>
                <password>access_password_for_traccar</password>
        </traccar>
        <!-- URL for GTFS realtime vechicle location feed, omit if you have provided connection details for Traccar above -->
        <gtfsRealtimeFeedURI>GTFS REALTIME VEHICLE POSITIONS URL</gtfsRealtimeFeedURI>
        <url>GTFS REALTIME VEHICLE POSITIONS URL</url>
        <minLatitude>COMPLETE FOR YOUR AREA - these fit all of Romania! 43.82247</minLatitude>
        <minLongitude>COMPLETE FOR YOUR AREA - these fit all of Romania! 20.40503</minLongitude>
        <maxLatitude>COMPLETE FOR YOUR AREA - these fit all of Romania! 47.96214</maxLatitude>
        <maxLongitude>COMPLETE FOR YOUR AREA - these fit all of Romania! 28.64511</maxLongitude>
    </avl>
   <db>
        <dbName>DB-NAME</dbName>
        <dbHost>DB-HOST:DB-PORT</dbHost> (localhost:3306)
        <dbType>DB-TYPE</dbType> (mysql)
        <dbUserName>DB-USER</dbUserName>
        <dbPassword>DB-PASSWOWRD</dbPassword>
    </db>
    <hibernate>
        <configFile>/usr/local/transitclock/config/hibernate_AGENCY.cfg.xml</configFile>
    </hibernate>
<web>
        <mapTileUrl>https://tile.openstreetmap.org/{z}/{x}/{y}.png</mapTileUrl>
    </web>
</transitclock>
Clone this wiki locally