TRACE-Q is a cutting-edge research project that addresses the critical need for efficient trajectory data processing in the realm of spatiotemporal databases. At its core, TRACE-Q employs the MRPA (Multi-Resolution Polygonal Approximation) algorithm to effectively simplify trajectory data. Unlike conventional simplification algorithms, TRACE-Q innovatively incorporates query accuracy as a pivotal factor in the simplification process. This ensures that the resulting simplified trajectories are not only compact but also retain high usability for subsequent queries. Our major contribution lies in this paradigm shift where the accuracy of post-simplification queries directly influences the simplification algorithm itself, paving the way for more precise and reliable spatiotemporal analyses.
Before running the application, ensure that you have downloaded the necessary project dependencies. Specifically, ensure that PostgreSQL is installed and added to your PATH variables.
For Windows users, navigate to the root directory and execute the following PowerShell script to set up the project dependencies:
./setup.ps1
For Linux users, navigate to the root directory and utilize the accompanying bash script to set up the project dependencies:
./setup.sh
Optional: The loading of datasets can be skipped by using the -skipdatasets
flag.
For manual setup, follow the steps below to prepare the environment and datasets.
Ensure you have the following datasets:
- T-Drive - A comprehensive taxi trajectory dataset.
- Geolife - A rich GPS trajectory dataset collected in a wide range of scenarios.
Create a structured directory within TRACE-Q/external/datasets
:
/t-drive
- For storing the T-Drive dataset./geolife
- For storing the Geolife dataset.
Position the unpacked datasets in their respective directories:
- Place the T-Drive dataset into
/t-drive
. - Insert the Geolife dataset into
/geolife
.
Run the following commands to create and configure the required database:
createdb -U postgres traceq
psql -U postgres -d traceq -c 'CREATE TABLE original_trajectories (id BIGSERIAL PRIMARY KEY, trajectory_id INTEGER NOT NULL, coordinates POINT NOT NULL, time BIGINT);' -c 'CREATE INDEX original_trajectories_index_coords ON original_trajectories USING GIST (coordinates);' -c 'CREATE INDEX original_trajectories_index_time ON original_trajectories (time);'
psql -U postgres -d traceq -c 'CREATE TABLE simplified_trajectories (id BIGSERIAL PRIMARY KEY, trajectory_id INTEGER NOT NULL, coordinates POINT NOT NULL, time BIGINT);' -c 'CREATE INDEX simplified_trajectories_index_coords ON simplified_trajectories USING GIST (coordinates);' -c 'CREATE INDEX simplified_trajectories_index_time ON simplified_trajectories (time);'
TRACE-Q is designed to be built using CMake. To build and run TRACE-Q, follow these steps:
-
Install CMake:: Ensure that you have CMake installed on your system. You can download it from CMake’s official website.
-
Clone the Repository: Clone the TRACE-Q repository to your local machine using the following command:
git clone https://github.com/KarmaKamikaze/TRACE-Q.git
- Navigate to the Project Directory: Change into the cloned repository’s directory:
cd TRACE-Q
- Create a Build Directory: Create a new directory for the build files:
mkdir build && cd build
- Generate Build System: Run CMake to generate the build system:
cmake ..
- Compile the Project: Compile the project using the generated build system:
cmake --build .
After successfully compiling the project, you will find the TRACE_Q executable in the build directory.
- Start the Backend API Server: Execute TRACE_Q to start the backend API server:
./TRACE_Q
This will launch a REST API server that listens for requests on the defined endpoints.
- Clone the Frontend Repository (Optional): Clone the accompanying TRACE-Q frontend repository:
git clone https://github.com/KarmaKamikaze/TRACE-Q-UI.git
-
Build the Frontend (Optional): Navigate to the frontend directory and follow the build instructions provided in the repository’s README.
-
Interact with the API: With the backend server running, you can now interact with the API through the available endpoints. Here are some of the endpoints you can use:
/insert
: Insert new trajectory data./load_from_id
: Load trajectory data by ID./load_from_id_date
: Load trajectory data by ID and date./run
: Execute the TRACE-Q algorithm on the imported trajectories./status
: Check the status of the simplification process./db_range_query
: Perform a range query on the simplified database./knn_query
: Execute a k-nearest neighbors query on the simplified database./reset
: Reset the database state./get_dates_from_id
: Retrieve available dates for a given trajectory ID.
By following these instructions, you can build and run TRACE-Q on your system, enabling you to perform efficient and accurate trajectory queries for your spatiotemporal research needs.
Feel free to adjust the URLs and commands to match your repository and system specifics. Good luck with your project!