Copie données WFS depuis le géoportail de l'urbanisme
✓ Published0🌍 Public
TThomasG77
Last edited Apr 19, 2024
Created on Apr 19, 2024
This example automates the bulk download of France’s urban planning WFS data from the Géoportail de l’Urbanisme, specifically extracting the GPKG files. It shows how to list available remote directories via `lftp` over SFTP, identify the latest dated export, and mirror the chosen folder with parallel transfers. The workflow uses shell commands with `timeout`, `ssh`, and `lftp` to handle authentication and file retrieval. It relies on public credentials and a documented PDF manual, making the process reproducible for users needing recent, structured land-use datasets.
AI-generated descriptionCopie données WFS depuis le géoportail de l'urbanisme
Ici on prend les données GPKG mais shp et CSV aussi disponibles selon vos préférences
# Infos pompées de https://www.geoportail-urbanisme.gouv.fr/image/Manuel_export_massif.pdf
# Obtenu via discussion https://georezo.net/forum/viewtopic.php?pid=367182#p367182
# Do once (to get ssh key)
timeout 5 ssh -oStrictHostKeyChecking=accept-new -p 2200 gpu_depot_exports@sftp-public.ign.fr
# List files
lftp sftp://gpu_depot_exports:yegh5EdeeFeegahz@sftp-public.ign.fr:2200 -e 'ls /pub/export-wfs/;exit' | cut -c 57- |grep -v '\.'
# To get last update with explicit directory date
lftp sftp://gpu_depot_exports:yegh5EdeeFeegahz@sftp-public.ign.fr:2200 -e 'ls /pub/export-wfs/;exit' | cut -c 57- |grep -v '\.' | grep -v latest | sort | tail -n1
# Then you can copy with either latest or date from above command
lftp sftp://gpu_depot_exports:yegh5EdeeFeegahz@sftp-public.ign.fr:2200 -e 'mirror --verbose --use-pget-n=8 -c /pub/export-wfs/latest/gpkg gpkg;exit'