Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

standardcode/travel-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Driving times in Poland

Goal

Answer questions about driving time and distance between Polish cities and villages.

Statistics

Driving times

Each dot is a city or a village and color indicates average driving time from this settlement to a random person in any other settlement in the country.

Nearest capital city

Nearest voivodeship's capital city and actual voivodeships boundaries.

Longest driving time between 2 cities

   start       | destination |    km   |    h
Ustrzyki Dolne |  Kołobrzeg  | 1013.51 | 11.318

Shortest way between 2 cities

     start    | destination |   m    |   s
Podkowa Leśna |   Brwinów   | 2772.8 | 252.8

City with shortest average driving time to other cities

  name  |   h   |    km     
Stryków | 2.596 | 244.384

City with longest average driving time to other cities

     name      |   h   |    km     
Ustrzyki Dolne | 6.347 | 508.290

examples.sql contains queries used to generate this statistics and more.

Getting Started

Database

  • Install PostgreSQL with PostGIS if you don't have it already.
  • Import schema from poland_schema.sql to your database.
  • You may download already calculated routes and skip next points.
  • Configure connection in js/config.js and in R/db.R.

Data

  1. Download and unzip ready package then go to point 3
  2. Or use raw data: download XLS files from this sites and convert them to CSV:
  1. Run insert-data-in-db.R with working directory set to the one containing the CSV files.

Routing server

Running

Set the numbers of cities and villages you want to calculate in js/config.js. There is 919 cities and 37177 villages. Calculations for all of them take about 45min on 2,6 GHz Intel Core i5. The computational complexity is O(n2) for cities and O(n) for villages.

Run calculation.

$ npm install
$ npm run build && npm run serve

Results

Run show-country-map.R to see resulting times as colors on a map.

About

Driving times between Polish cities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published