Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/NicolasDumoulin/distancematrix
Provides an environment for computing the distances between municipalities from France
https://github.com/NicolasDumoulin/distancematrix
Last synced: 3 months ago
JSON representation
Provides an environment for computing the distances between municipalities from France
- Host: GitHub
- URL: https://github.com/NicolasDumoulin/distancematrix
- Owner: NicolasDumoulin
- Created: 2016-01-15T14:21:04.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-15T14:23:29.000Z (almost 9 years ago)
- Last Synced: 2024-06-12T18:13:29.436Z (5 months ago)
- Language: Python
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Distances computations between french municipalities
The purpose is to provide an environment for computing the distances between municipalities from France.
For that, I propose to you to build a docker image that will install all required software and tools.
## Building the docker imageThe first step is to built the docker image that will install the [OSRM backend](https://github.com/Project-OSRM/osrm-backend), the [python library osrm-c](https://github.com/tdihp/osrm-c) as frontend and the scripts for the distances matrix computation.
docker build -t distances .
## Starting the docker image
Now, you can start the docker image with this command:
docker run --interactive=true --tty=true --ulimit memlock=68719476736 --privileged --volume=$(pwd):/root/distancesmatrix/data distances
We need to enable the shared memory.
According to [this document](https://github.com/Project-OSRM/osrm-backend/wiki/Configuring-and-using-Shared-Memory), we use the option `--ulimit` of docker with attributes `memlock=68719476736`## Init the OSRM service / Import the data
Then, as you are in the container, you have to run the script `run.sh` with your osm.pbf extract file as input:
./data/run.sh data/cantal-rectangle.osm.pbf
After that, the data have been extracted by OSRM and loaded into shared memory.## Distances computations
python data/computeDistances.py
In France (metropolitain), we have 36571 municipalities, giving 668700735 distances to compute for each couple of municipalities for one direction (municipality A to B) and 1337401470 (1.34E+9) if we consider the two directions (distance from A to B and from B to A).
Considering the two directions can be determinant for some municipality, if for example they can enter easily on a motorway in a direction, but should made a detour in the other one.Considering only couples of municipalities that have an euclidean distance lesser than 100km, we have 37101055 distances to compute (for each direction).