Answer questions about driving time and distance between Polish cities and villages.
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 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.
- 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 inR/db.R
.
- Download and unzip ready package then go to point 3
- Or use raw data: download XLS files from this sites and convert them to CSV:
- Cities population link Powierzchnia i ludność w przekroju terytorialnym w 2016 r. - tablice
- Geolocation link PRNG - nazwy miejscowości
- Villages population (optional) link Pobierz
- Run
insert-data-in-db.R
with working directory set to the one containing the CSV files.
- Build OSRM.
- Download map of Poland. Mirrors with other maps.
- Convert map to
.osrm
. - Set path to the file in
js/config.js
.
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
Run show-country-map.R
to see resulting times as colors on a map.