Skip to content

Given a GPS tracker data from call a MapMatching and calculate the time take in each edge.

License

Notifications You must be signed in to change notification settings

chucre/time-travel

Repository files navigation

To run project you will need install map-matching from https://github.com/chucre/map-matching.

$ git clone https://github.com/chucre/map-matching

Then you will need download a OpenStreet Map database (I use brazil database):

$ cd map-matching
$ wget download.geofabrik.de/south-america/brazil-latest.osm.pbf

Once you have the databse downloaded, you will need import it into graphhopper internal database

$ ./map-matching.sh action=import datasource=./brazil-latest.osm.pbf vehicle=car

Now you will start the map-matching server:

./map-matching.sh action=start-server

Now you will need open a new terminal and unzip sample file and run project:

$ npm install
$ gunzip sample/points.txt.gz
$ node processFile.js


These project is based on Chucre time travel algorithm that fallows:

case 1:


          Link 1                   Link 2                Link 3
+---------------------------+------------------------+-------------------------+
|                           |                        |                         |
 +-----+---+----+----+----+  +-----+---------+------+ +-----------------------+
         |               |                              |                  |
   point 0               |                              point x            |
                    point n(last)                                 point z (last)


case 2:
        Link 1                   Link2
+-------------------------+--------------------------+
|                         |                          |
 +-----------------------+ +------------------------+
   |                  |
   point 0         point n

pseudo code:

  delta_inicial
  delta_final
  t_inicial
  t_final
  percurso_percorrido
  tempo_percorrido_conhecido = t_final-t_inicial
  tempo_total = tempo_percorrido_conhecido+proporção_percorrida_até a proxima coleta

  achou_ponto_inicial <- false
  achou_ponto_final <- false

  link <- cada line|multiline do link
    if !achou_ponto_inicial
      if ponto_inicial lies link
        delta_inicial += distance_to(link[0], ponto_inicial)
        persurso_percorrido += distance_to(link[1], ponto_inicial)
        achou_ponto_inicial=true
      else
        delta_inicial += distance_to(link[0], link[1])
      end
    else if !achou_pont_final
      if ponto_final lies link
        persurso_percorrido += distance_to(link[0], ponto_final)
        delta_final += distance_to(link[1], ponto_final)
      else
        persurso_percorrido += distance_to(link[0], link[1])
      end
    else
      delta_final += distance_to(link[0], link[1])
    end

About

Given a GPS tracker data from call a MapMatching and calculate the time take in each edge.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published