author: Diego Cusicanqui contributors: Jean Baptiste Barré
contact: diego.cusicanqui@univ-grenoble-alpes.fr
Python scripts to quick download and resample LiDAR HD classified point clouds from IGN-France. This python script can be executed on command line interface (CLI) as well as within a Jupyter Notebook. Look at the How to use section for more details.
Refer to IGN-France website for news about data processing.
In order to install properly, you have to clone lidar_ign_downloader
repository.
git clone https://github.com/cusicand/lidarhd_ign_downloader.git
cd ./lidarhd_ign_downloader
Most of the libraries required for this script are standard and are often pre-installed in conda python environments. Please follow the instructions below depending on your requirements.
If you already have a conda python environment pre-installed, please follow the instruction in section Install on pre-existing conda python environment section. Otherwise, you will need to install a conda python environment to use this script. Instructions are given in the section Install packages on a new conda python environment.
Run the next command lines in your command-line prompt:
conda activate <your-env-name>
or
conda install -c conda-forge pdal==2.5.6 draco=1.5.6 python-pdal gdal untwine geopandas python-wget pathlib2 tqdm ipykernel pyogrio
We encourage the use of mamba
since this library as is faster than conda.
If you want to use mamba
, run the following lines:
conda activate <your-env-name>
mamba install -c conda-forge pdal==2.5.6 draco=1.5.6 python-pdal gdal untwine geopandas python-wget pathlib2 tqdm
If you want to create a specific python environment, please follow the instructions below.
Go to the Miniconda website and download the lastest version of Miniconda. Detailed instructions on how to install conda python environments for your operating system are available on the Anaconda website.
Once conda installed, you can
mamba
First, install mamba
conda install -n base -c conda-forge mamba
then, install all packages using the pdal_env.yml
file provided.
mamba env create -f pdal_env.yml
To active the environment, type conda activate pdal_env
conda
conda env create -f pdal_env.yml
To active the environment, type:
conda activate pdal_env
If you want to run the script anywhere in your computer from CLI, you need to add the following lines to your .bashrc
file to have full access to scripts.
Open your .bashrc
file using vi ~/.bashrc
or nano ~/.bashrc
and copy the following lines at the end.
export LIDAR_PATH=$HOME/lidarhd_ign_downloader
export PATH=$LIDAR_PATH:$PATH
export PYTHONPATH=$LIDAR_PATH:$PYTHONPATH
[!NOTE]
If your installation directory is different than$HOME
, Replace$HOME
by the full directory path.
Once changes saved, run chmod +x lidar_downloader.py
into github repository to ensure the execution of the script.
Use source ~/.bashrc
to reload changes.
After version 2.0 of lidar_downloader
we introduce the possibility to generate point density map to quantitatively estimate the number of points at a given resolution. This tasks is based on pdal_wrench
and requires individual installation. A detailed description could be found wrench GitHub. Further investigation are ongoing to better integrate pdal_wrench within lidar_downloader
.
Once pdal_wrench
installed, it is better you can run it from everywhere in the computer. To do so, add the following lines to your .bashrc
.
export PDWRENCH=$HOME/wrench/build/
export PATH=$PDWRENCH:$PATH
[!NOTE] If your installation directory is different than
$HOME
, Replace$HOME
by the full directory path.
Inside the command line prompt, type python lidar_downloader.py -h
to access to the help of the tool.
This small tool needs and Area of Interest (AOI) in .shp or .gpkg format as mandatory argument. Then, we can switch between several parameters like:
Then, we can switch between several parameters like:
-out_data
or --out_data_path
Out data-path directory. If not specified, data will be stored in lidar_downloader.py base-path by default.-tr
or --dem_resolution
to select the desired resolution of the output DEM.-compute_elev
or --compute_elevation
to select the way of how compute elevation. options are {mean,min,max,median}. Default value : mean. This parameter is still experimental.-dtype
or --file_data_type
to switch between GTiff
and VRT
files.-force_database
or --force_redownload_database
to force re-download of IGN database. Default value: False.-rm_tiles
or --remove_tiles
to remove individual downloaded tiles after processing. Default value: True.-pdensity
or --point_density_map
to generates point density map for given resolution. Requires pdal_wrench installed. Default value: True. Refer to []()Below is an example using the supplied shapefile:
lidarhd_downloader.py aoi_example.gpkg -out_data /home/user/some/path/directory/ -tr 1 -compute_elev mean -dtype gtif
or
lidarhd_downloader.py aoi_double.shp --out_data_path /home/user/some/path/directory/ --dem_resolution 1 --compute_elevation mean --file_data_type gtif
Inside a Jupyter-Notebook, you can also run the lidar_downloader
. However, the set up of parameters are is slightly different. You can see and use the example provided within the project.
import lidar_downloader
args_list = ['/path/to/aoi/aoi_example.gpkg',
'--out_data_path', '/some/path/directory/lidar_ign_test/',
'--dem_resolution', '1.0',
'--compute_elevation', 'mean',
'--file_data_type', 'gtif',
'--remove_tiles']
parser = lidar_downloader.getparser()
args = parser.parse_args(args_list)
lidar_downloader.main(args)
[!NOTE]
Whatever the case, the script will iterate through all the features (polygons) within the shapefile or geopackage file. It will create a folder for each specific AOI based on the column with theaoi_name
. If you used your own shapefile, make sure to have one column calledaoi_name
. Otherwise, you can edit the provided file.
For any question/bug/issue, please report it on issues section or contact diego.cusicanqui@univ-grenoble-alpes.fr
[!IMPORTANT]
Please don't be lazy and cite this tool using the following DOI.