pip install -e .
python scripts/download_FILO.py
python scripts/download_BAN.py
from popdbgen import load_FILO, load_BAN
filo_974 = load_FILO("974")
ban_974 = load_BAN("974")
python scripts/generate_database.py --territory 974
python scripts/generate_database.py --territory france --batchsize 100_000
See python scripts/generate_database.py --help
for more options.
from popdbgen import get_households_population_gdf
households, population = get_households_population_gdf(filo_df=filo, ban_df=ban)
The generated households database can be converted to a tiled format for data exploration.
geopackage
files can be processed into the mbtiles
tiled format using tippecanoe
:
France
ogr2ogr -f GeoJSONSeq /vsistdout/ households_france.gpkg | tippecanoe -z15 --drop-densest-as-needed -P -o households_france.mbtiles -l households
ogr2ogr -f GeoJSONSeq /vsistdout/ carreaux_200m_met.gpkg | tippecanoe -z15 --drop-densest-as-needed -P -o carreaux_200m_met.mbtiles -l filo
La Réunion
ogr2ogr -f GeoJSONSeq /vsistdout/ households_974.gpkg | tippecanoe -z15 --drop-densest-as-needed -P -o households_974.mbtiles -l households
ogr2ogr -f GeoJSONSeq /vsistdout/ carreaux_200m_reun.gpkg | tippecanoe -z15 --drop-densest-as-needed -P -o carreaux_200m_reun.mbtiles -l filo
Several mbtiles
files can be joined in a single file in which datasets are represented as "layers":
tile-join -pk -o filo_households_france.mbtiles carreaux_200m_met.mbtiles households_france.mbtiles
tile-join -pk -o filo_households_974.mbtiles carreaux_200m_reun.mbtiles households_974.mbtiles
NOTE: While packing layers together is convenient for visualisation, it may not be the best option, for instance to embed the tiled data in a website.
The generated mbtiles
can then be converted to the pmtiles
format (tippecanoe
tends to generate broken pmtiles
files):
France
pmtiles convert households_france.mbtiles households_france.pmtiles
pmtiles convert carreaux_200m_met.mbtiles carreaux_200m_met.pmtiles
pmtiles convert filo_households_france.mbtiles filo_households_france.pmtiles
La Réunion
pmtiles convert households_974.mbtiles households_974.pmtiles
pmtiles convert carreaux_200m_reun.mbtiles carreaux_200m_reun.pmtiles
pmtiles convert filo_households_974.mbtiles filo_households_974.pmtiles
wget https://github.com/protomaps/go-pmtiles/releases/download/v1.26.1/go-pmtiles_1.26.1_Linux_x86_64.tar.gz
tar -zxvf go-pmtiles_1.26.1_Linux_x86_64.tar.gz