Skip to content

MobilityDB/MobilityDB-BerlinMOD-Hanoi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BerlinMOD-Hanoi Data for MobilityDB

MobilityDB is an open source software program that adds support for temporal and spatio-temporal objects to PostgreSQL and its spatial extension PostGIS.

This repository adapts the BerlinMOD benchmark to Hanoi (Vietnam) using OSM data and MobilityDB.
It provides tools to generate synthetic mobility datasets, convert them into GeoJSON, and visualize them with Kepler.gl or QGIS + MOVE plugin.

  • Visualization with Kepler:

    • Trips:
    • Municipalities:
  • Visulaization with QGIS + MobilityDB-Move


1. Getting the OSM Map of Hanoi

First, download OpenStreetMap (OSM) data of Hanoi with bbox setting as below:

CITY="hanoi"
BBOX="105.28,20.56,106.07,21.384"
wget -O "${CITY}.osm" "http://www.overpass-api.de/api/xapi?*[bbox=${BBOX}][@meta]"

Clone the repository:

git clone --recurse-submodules https://github.com/MobilityDB/MobilityDB-BerlinMOD-Hanoi.git
cd MobilityDB-BerlinMOD-Hanoi

Create database hanoi, and add all extension needed:

# in a console:
createdb -h localhost -p 5432 -U dbowner hanoi
# replace localhost with your database host, 5432 with your port,
# and dbowner with your database user
psql -h localhost -p 5432 -U dbowner -d hanoi -c 'CREATE EXTENSION hstore'
# adds the hstore extension needed by osm2pgsql
psql -h localhost -p 5432 -U dbowner -d hanoi -c 'CREATE EXTENSION MobilityDB CASCADE'
# adds the PostGIS and the MobilityDB extensions to the database
psql -h localhost -p 5432 -U dbowner -d hanoi -c 'CREATE EXTENSION pgRouting'
# adds the pgRouting extension

Using mapconfig.xml in MobilityDB-BerlinMOD to select the roads type, load the map and convert it into a routable network topology format:

osm2pgrouting -h localhost -p 5432 -U dbowner -W passwd -f hanoi.osm --dbname hanoi \
-c MobilityDB-BerlinMOD/BerlinMOD/mapconfig.xml

2. Generating Data for Hanoi

Use the hanoi_preparedata.sql script provided in this reposity to make the data realistic with real population statistics in every administrative region in Hanoi.

osm2pgsql -c -H localhost -P 5432 -U dbowner -W -d hanoi hanoi.osm
# loads all layers in the osm file, including the adminstrative regions
psql -h localhost -p 5432 -U dbowner -d hanoi -f hanoi_preparedata.sql
# samples home and work nodes, transforms data to SRID 3857, does further data preparation

Then execute generator of BerlinMOD to get synthetic data for Hanoi:

psql -h localhost -p 5432 -U dbowner -d hanoi -f MobilityDB-BerlinMOD/BerlinMOD/berlinmod_datagenerator.sql
psql -h localhost -p 5432 -U dbowner -d hanoi \
-c 'select berlinmod_generate(scaleFactor := 0.005)'
#generate data with a specific scale

3. Exporting GeoJSON for visualization with Kepler.gl

We provide SQL functions to export municipalities/trips as GeoJSON for Kepler.gl:

psql -h localhost -p 5432 -U dbowner -d hanoi -f export_geojson.sql
psql -h localhost -p 5432 -U dbowner -d hanoi \
-c 'SELECT export_trip('path', 'date')'
# Get trip_<date>.geojson file
psql -h localhost -p 5432 -U dbowner -d hanoi \
-c 'SELECT export_municipalities('path')'
# Get municipalities.geojson

4. Generated Datasets

Scale Factor Vehicles Days Trips File Size
SF 0.001 63 3 549 hanoi_sf0.001.zip 114.1 MB
SF 0.002 89 3 758 hanoi_sf0.002.zip 121.5 MB
SF 0.005 141 4 1,620 hanoi_sf0.005.zip 190.2 MB
SF 0.01 200 5 2,903 hanoi_sf0.01.zip 294.5 MB
SF 0.02 283 6 4,641 hanoi_sf0.02.zip 401.3 MB
SF 0.05 447 8 9,491 hanoi_sf0.05.zip 716.5 MB
SF 0.1 632 11 18,910 hanoi_sf0.1.zip 1.37 GB
SF 0.2 894 15 35,319 hanoi_sf0.2.zip 2.42 GB
SF 0.5 1414 22 81,584 hanoi_sf0.5.zip 5.53 GB

Trips geoJSON file: trips_2020-06-01.geojson (All synthetic trips in Hanoi in 2020-06-01 with scale of 0.001)

Municipalities geoJSON file: municipalities.geojson

About

MobilityDB-BerlinMOD instantiated with Hanoi (Vietnam) data from OSM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors