GithubHelp home page GithubHelp logo

adeyeha / spatiotemporal-trajectory-index Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 46.54 MB

Grid-mapped Interval Trees (G-IT) for Spatiotemporal Trajectories

Python 19.12% Jupyter Notebook 80.88%
indexing-algorithms interval-tree rtree spatio-temporal

spatiotemporal-trajectory-index's Introduction

Grid-mapped Interval Trees (G-IT) for Spatiotemporal Trajectories

This project implements a spatiotemporal trajectory index called Grid-mapped Interval Trees (G-IT) in Python. It provides a simple trajectory access mechanism primarily designated for historical persistent spatiotemporal data. The project contains three main files: GIT.py, which implements the G-IT index, and Trajectory.py, which implements the trajectory data type and testGIT.py, which implements test cases.

Getting Started

Prerequisites

The following Python libraries are required to run this project:

  • Shapely
  • Intervaltree

You can install them using pip:

pip install shapely
pip install intervaltree

Files

  1. GIT.py: Implementation of the G-IT index.
  2. Trajectory.py: Implementation of the trajectory data type.
  3. TestGIT.py: A script that inserts a toy dataset into a G-IT index instance and tests different query types.

Running the Code

To run the TestGIT.py script, simply execute the following command:

python TestGIT.py

This will create a G-IT index instance, insert a toy dataset into the index, and perform various queries. The output will show the results of the queries, which include spatial window query, temporal window query, and spatio-temporal window query.

Usage

To use the G-IT index and trajectory classes in your own project, you can import them as follows:

from GIT import GIT
from Trajectory import Trajectory

Create a G-IT index instance by specifying the parameters for the spatial grid:

git_index = GIT(sf_xmin=0, sf_xmax=100, sf_ymin=0, sf_ymax=100, delta_x=10, delta_y=10)

Create a trajectory instance and insert it into the G-IT index:

from shapely.geometry import Point

traj = Trajectory(1, [(1, Point(5, 5)), (2, Point(5, 15)), (3, Point(15, 15)), (4, Point(25, 5))])
git_index.insert(traj)

Perform various queries on the G-IT index:

# Spatial window query
result = git_index.spatial_window_query(x1, y1, x2, y2)

# Temporal window query 
result = git_index.temporal_window_query(t1, t2)

# Spatio-temporal window query 
result = git_index.spatio_temporal_window_query(x1, y1, x2, y2, t1, t2)

spatiotemporal-trajectory-index's People

Contributors

adeyeha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.