This repository contains the code to reconstruct OD coordinates based on the crow fly distance, the origin zone, and the destination zone of the trip, and the zone shapefile.
Depending on the study area, the zone can be for example:
- Municipality + Districts for Switzerland
- Municipality for Ile-de-France (France)
- Zone fine for Lille (France)
- Census tract for California (USA)
The following sections describe how to reconstruct OD locations for Lille, precily for the MEL area.
This guide will cover the following steps:
- Gathering the data
- Running the script
The data used in the case of OD reconstruction in the case of MEL, are all available in open access from the Opendata web site of the city.
The main data necessary to reconstruct the OD are the trips data (origin drawing sector, destination drawing sector, crowfly distance), and the GIS (shapefile) data of the draw sectors. In the policy of anonymizing the survey data, the MEL has blurred the fine zones of Origin and destination of trips. Only the drawing sectors are provided. The OD reconstruction algorithm takes all his sens here by providing a solution to reconstitute the coordinates of the locations without betraying the principle of anonymization of personal data.
All data sets need to be named in a specific way and put into specific sub-directories. The following paragraphs describe this process.
-
EMD 2016 The household travel survey is available from the MEL:
- EMD 2016
- Scroll all the way down the website to the Exports alternatifs.
- Download the Base_ED_2016.zip and unzip the file.
- Transform the text files DEPLAO, MENAGE, PERSO and TRAJETO according the dico of variables (Excel file 20171128_DessinDico_FAF_ EDGT MEL_opendata) into CSV file
- Put the csv files int othe folder data/emd_2016_lille_opendata.
-
The shape file of drawing sectors is also available from the MEL OpenData
- Scroll down the website to the Formats de fichiers géographiques.
- Download the Shapefile and unzip it.
- Put the shape files int othe folder data/emd_2016_lille_opendata/shape_files.
-
Overview Your folder structure should now have at least the following files:
data/emd_2016_lille_opendata/DEPLAO.csv
data/emd_2016_lille_opendata/MENAGE.csv
data/emd_2016_lille_opendata/PERSO.csv
data/emd_2016_lille_opendata/TRAJETO.csv
data/emd_2016_lille_opendata/shapes_files/enquete-deplacement-2016.dbf
data/emd_2016_lille_opendata/shapes_files/enquete-deplacement-2016.prj
data/emd_2016_lille_opendata/shapes_files/enquete-deplacement-2016.shp
data/emd_2016_lille_opendata/shapes_files/enquete-deplacement-2016.shx
The script code is available in this repository. To use the code, you have to clone the repository with git:
git clone https://github.com/eqasim-org/od-reconstruction
which will create the od-reconstruction folder containing the script code. To set up all dependencies, we recommend setting up a Python environment using Anaconda:
cd od-reconstruction
conda env create -f environment.yml
This will create a new Anaconda environment with the name od-reconstruction. (In case you don't want to use Anaconda, we also provide a requirements.txt to install all dependencies in a virtualenv using pip install -r requirements.txt).
To activate the environment, run:
conda activate od-reconstruction
To set up the output directory, create a output directory.
mkdir output
To run the scrit,