OpenGTS Integration

/OpenGTS Integration
OpenGTS Integration 2017-04-21T22:25:43+00:00

Traccar can be easily integrated with OpenGTS tracking system. After integration Traccar will write data directly into the OpenGTS database. You will be able to use most features from OpenGTS system with advantage of support for all Traccar communication protocols, but Traccar web interface will not be available.

To integrate Traccar with OpenGTS you need to do following modification to Traccar config file:

  • Remove all event.* entries from the config
  • Change web.enable value to false
  • Modify database connection properties (replace
    [DATABASE], [USER], [PASSWORD] with correct values):
  •     <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
        <entry key='database.url'>jdbc:mysql://localhost:3306/[DATABASE]?allowMultiQueries=true</entry>
        <entry key='database.user'>[USER]</entry>
        <entry key='database.password'>[PASSWORD]</entry>
  • Remove database.changelog and all SQL queries from the config
  • Add OpenGTS-specific SQL queries:
  •     <entry key='database.selectDevicesAll'>
            SELECT CONCAT('1', imeiNumber) AS id, imeiNumber AS uniqueId FROM Device WHERE imeiNumber REGEXP '^[0-9]+$';
        <entry key='database.insertPosition'>
                UPDATE Device SET lastValidLatitude = :latitude, lastValidLongitude = :longitude, lastGPSTimestamp = UNIX_TIMESTAMP(:fixTime), lastUpdateTime = UNIX_TIMESTAMP(NOW()) WHERE imeiNumber = SUBSTRING(CAST(:deviceId AS CHAR(32)), 2);
                SELECT @accountID := accountID, @deviceID := deviceID FROM Device WHERE imeiNumber = SUBSTRING(CAST(:deviceId AS CHAR(32)), 2);
                INSERT INTO EventData (accountID, deviceID, timestamp, statusCode, latitude, longitude, speedKPH, heading, altitude, rawData, creationTime, address)
                VALUES (@accountID, @deviceID, UNIX_TIMESTAMP(:fixTime), 0, :latitude, :longitude, :speed * 1.852, :course, :altitude, '', UNIX_TIMESTAMP(NOW()), :address);