Git Product home page Git Product logo

simple-trajectory-compressor's Introduction

simple-trajectory-compressor

A simple implementation of polyline encoding algorithm in Java.

Principles

Google Maps Platform Doc: Encoded Polyline Algorithm Format.
My blog(简体中文): 轨迹压缩算法(Polyline encoding algorithm)探究

Usage

  1. Create an object trjCompressor:
TrjCompressor trjCompressor = new TrjCompressor(6);

The parameter of the constructor is the precision of this compressor. For example, if the parameter is 6, then only 6 decimal places are reserved for floating point numbers.

  1. Encode List<PointTs> to a single string:
String encoding = trjCompressor.encode(points); //type of points is List<PointTs>
  1. Decode the compressed code to List<PointTs>:
List<PointTs> decoding = trjCompressor.decode(trjCode) //type of trjCode is String

Performance

Since it's a compression algorithm, I did a simple experiment to calculate the compression rate(compared to json format).
The trajectory data of the experiment is downloaded from Microsoft GeoLife and 171 trajectories are used. The code of this experiment is in the file TrjCompressorTest.java, you can change the value of path which contains the trajectory data from GeoLife if you want to do the similar experiment. Here is the result of the experiment:

mean of compression rate: 10.811463326040565 %
median of compression rate: 10.643147359032803 %

The mean and median of compression rates is about 10% in this experiment. It can be concluded that, polyline encoding algorithm is an excellent compression algorithm for trajectory data.

simple-trajectory-compressor's People

Contributors

guanhonly avatar dependabot[bot] avatar

Stargazers

QuantumGhost avatar 李小义 avatar oewang avatar Carlos Quin avatar  avatar  avatar John  avatar eeeqzq avatar Jeffrey Wang avatar MarvinR2D2 avatar nick avatar  avatar  avatar  avatar Hongli Guan avatar Xie Chong avatar Linxu Han avatar Liebing avatar

Watchers

James Cloos avatar  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.